package com.simtop.controller;

import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.simtop.common.ServerResponse;
import com.simtop.pojo.*;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.huaban.analysis.jieba.JiebaSegmenter;
import com.simtop.pojo.SqyxBase;
import com.simtop.service.CaptchaControllerServer;
import com.simtop.service.SqyxBaseServer;
import com.simtop.service.SqyxLabelServer;
import com.simtop.util.JwtUtil;
import com.simtop.util.ResultBean;
import com.simtop.util.StringUtils;
import com.simtop.vo.LabVo;
import jnr.ffi.annotations.In;
import org.apdplat.word.WordSegmenter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.regex.Pattern;
import java.util.stream.Stream;

/**
 * 社群用户展示接口
 * gitCaptchaUser
 */
@Controller
@RequestMapping("/squser")
//@CrossOrigin //todo 跨域问题
public class CommunityController {


    @Autowired
    private CaptchaControllerServer captchaControllerServer;

    @Autowired
    private SqyxBaseServer sqyxBaseServer;

    @Autowired
    private SqyxLabelServer sqyxLabelServer;


    /*
     *
     *功能描述  用户分析数据展示
     * @author lzb
     * @date 2022/1/12
     * @param
     * @return
     */
    @RequestMapping("/gitCaptchaUser")
    @ResponseBody
    public ResultBean gitCaptchaUser(@RequestBody String data) {
        //初始界面 默认获取所有社群用户信息
        JSONObject jsonObject = JSON.parseObject(data);
        Integer pageNum = jsonObject.getInteger("pageNum");
        Integer pageSize = jsonObject.getInteger("pageSize");

        //初始化页面信息
        if (StringUtils.isNull(pageNum) || pageNum == 0) {
            pageNum = 1;
        }
        if (StringUtils.isNull(pageSize) || pageSize == 0) {
            pageSize = 10;
        }
        try {
            //启动分页
            PageHelper.startPage(pageNum, pageSize);
            //显示所有用户
            List<SqyxBase> sqyxBases = sqyxBaseServer.selectAllPeoper();
            PageInfo<SqyxBase> pageInfo = new PageInfo<SqyxBase>(sqyxBases);
            return ResultBean.success("获取社群用户信息成功", pageInfo);
        } catch (Exception e) {
            e.printStackTrace();

            return ResultBean.error("获取社群用户信息失败");
        }

    }

    @RequestMapping("/gitCapt")
    @ResponseBody
    public ResultBean gitCapt(@RequestBody String data) {
        //初始界面 默认获取所有社群用户信息
        JSONObject jsonObject = JSON.parseObject(data);
        Integer pageNum = jsonObject.getInteger("pageNum");
        Integer pageSize = jsonObject.getInteger("pageSize");

        //初始化页面信息
        if (StringUtils.isNull(pageNum) || pageNum == 0) {
            pageNum = 1;
        }
        if (StringUtils.isNull(pageSize) || pageSize == 0) {
            pageSize = 10;
        }
        try {
            //启动分页
            PageHelper.startPage(pageNum, pageSize);
            //显示所有用户
            List<SqyxBase> sqyxBases = sqyxBaseServer.selectAllPeoper2();
            PageInfo<SqyxBase> pageInfo = new PageInfo<SqyxBase>(sqyxBases);
            return ResultBean.success("获取社群用户信息成功", pageInfo);
        } catch (Exception e) {
            e.printStackTrace();

            return ResultBean.error("获取社群用户信息失败");
        }

    }

    /*
     *
     *功能描述   获取父类标签
     * @author lzb
     * @date 2022/1/13
     * @param
     * @return
     */
    @RequestMapping("girFirstLabel")
    @ResponseBody
    public ResultBean girFirstLabel() {
        List<SqyxLabel> girFirstLabel = sqyxLabelServer.girFirstLabel();
        return ResultBean.success(girFirstLabel);
    }

    /*
     *  新增 发言
     *功能描述 存入标签
     * @author lzb
     * @date 2022/1/18
     * @param
     * @return
     */
    @RequestMapping("createCommunityUserTagsOne")
    @ResponseBody
    public ResultBean createCommunityUserTagsOne(@RequestBody String data, HttpServletRequest request) {
        String token = request.getHeader("Authorization");
        String jwt = token.substring(token.lastIndexOf(" ") + 1);
        User u = JwtUtil.unsign(jwt, User.class);
        if (u == null) {
            return ResultBean.error("token无效");
        }

        try {


            JSONObject jsonObject = JSON.parseObject(data);
            //拿到所有条件
            //查询到人数后 存入标签库
            //默认对xxx进行统计
            //找到所有的name 然后去重
            Integer cheadid = null;
            String labelname = null;
            String remark = null;
            String profession = null;
            String area = null;
            String constellation = null;
            String topicshare01 = null;

            constellation = jsonObject.getString("星座");

            cheadid = jsonObject.getInteger("cheadid");
            labelname = jsonObject.getString("labelname");
            remark = jsonObject.getString("remark");
            profession = jsonObject.getString("职业");
            area = jsonObject.getString("城市");
            //拿到条件
            String sex = null;
            sex = jsonObject.getString("sex");
            Integer type = null;
            type = jsonObject.getInteger("type");


            JSONObject age = null;
            age = jsonObject.getJSONObject("age");
            String fh = null;
            Integer put = null;
            int countage = 0;

            if (age != null) {
                //拿到put
                fh = age.getString("fh");
                put = age.getInteger("put");
                System.out.println(fh);
                System.out.println(put);
                int dyage = 0;
                int xyage = 0;

                if (fh.equals("大于")) {
                     dyage = sqyxBaseServer.dyage(put);
                }
                if (fh.equals("小于")) {
                     xyage = sqyxBaseServer.xyage(put);
                }
                countage = dyage + xyage ;
                System.out.println(countage);
            } else {
                age = null;
                fh = null;
                put = null;
            }

            JSONObject hd = null;
            hd = jsonObject.getJSONObject("活动参与度");
            String hdfh = null;
            Integer hdput = null;
            int hdcountage = 0;

            if (hd != null) {
                //拿到put
                hdfh = hd.getString("fh");
                hdput = hd.getInteger("put");
                System.out.println(fh);
                System.out.println(put);
                int hdhd = 0;
                int putput = 0;

                if (hdfh.equals("大于")) {
                    hdhd = sqyxBaseServer.dyagehy(hdput) ;
                }
                if (hdfh.equals("小于")) {
                    putput = sqyxBaseServer.xyagehy(hdput) ;
                }
                hdcountage = hdhd + putput ;

            } else {
                hd = null;
                hdfh = null;
                hdput = null;
            }


            //    点赞
            JSONObject dz = null;
            dz = jsonObject.getJSONObject("点赞率");
            String dzfh = null;
            Integer dzput = null;
            int dzcountage = 0;

            if (dz != null) {
                //拿到put
                dzfh = dz.getString("fh");
                dzput = dz.getInteger("put");

                int hdhd = 0;
                int putput = 0;

                if (dzfh.equals("大于")) {
                    hdhd = sqyxBaseServer.dyagedz(dzput) ;
                }
                if (dzfh.equals("小于")) {
                    putput = sqyxBaseServer.xyagedz(dzput) ;
                }
                dzcountage = hdhd + putput ;

            } else {
                dz = null;
                dzfh = null;
                dzput = null;
            }

            //    点赞
            JSONObject fqfq = null;
            fqfq = jsonObject.getJSONObject("话题发起");
            String fqfqdzfh = null;
            Integer fqfqdzput = null;
            int fqfqdzcountage = 0;

            if (fqfq != null) {
                //拿到put
                fqfqdzfh = fqfq.getString("fh");
                fqfqdzput = fqfq.getInteger("put");

                int hdhd = 0;
                int putput = 0;

                if (fqfqdzfh.equals("大于")) {
                    hdhd = sqyxBaseServer.dyage(fqfqdzput) ;
                }
                if (fqfqdzfh.equals("小于")) {
                    putput = sqyxBaseServer.xyage(fqfqdzput) ;
                }
                fqfqdzcountage = hdhd + putput ;

            } else {
                fqfq = null;
                fqfqdzfh = null;
                fqfqdzput = null;
            }

            //    客单价
            JSONObject kdkd = null;
            kdkd = jsonObject.getJSONObject("客单价");
            String kdkddzfh = null;
            Integer kdkddzput = null;
            int kdkddzcountage = 0;

            if (kdkd != null) {
                //拿到put
                kdkddzfh = kdkd.getString("fh");
                kdkddzput = kdkd.getInteger("put");

                int hdhd = 0;
                int putput = 0;

                if (kdkddzfh.equals("大于")) {
                    hdhd = sqyxBaseServer.dyagekdj(kdkddzput) ;
                }
                if (kdkddzfh.equals("小于")) {
                    putput = sqyxBaseServer.xyagekdj(kdkddzput) ;
                }
                kdkddzcountage = hdhd + putput ;

            } else {
                kdkd = null;
                kdkddzfh = null;
                kdkddzput = null;
            }


            //    huo yue huo yue
            JSONObject hyhy = null;
            kdkd = jsonObject.getJSONObject("消费活跃用户");
            String hyhydzfh = null;
            Integer hyhydzput = null;
            int hyhydzcountage = 0;

            if (hyhy != null) {
                //拿到put
                hyhydzfh = hyhy.getString("fh");
                hyhydzput = hyhy.getInteger("put");

                int hdhd = 0;
                int putput = 0;

                if (hyhydzfh.equals("大于")) {
                    hdhd = sqyxBaseServer.dyage(hyhydzput) ;
                }
                if (hyhydzfh.equals("小于")) {
                    putput = sqyxBaseServer.xyage(hyhydzput) ;
                }
                hyhydzcountage = hdhd + putput ;

            } else {
                hyhy = null;
                hyhydzfh = null;
                hyhydzput = null;
            }

            //   consumption
            JSONObject concon = null;
            concon = jsonObject.getJSONObject("consumption");
            String concondzfh = null;
            Integer concondzput = null;
            int concondzcountage = 0;

            if (concon != null) {
                //拿到put
                concondzfh = concon.getString("fh");
                concondzput = concon.getInteger("put");

                int hdhd = 0;
                int putput = 0;

                if (concondzfh.equals("大于")) {
                    hdhd = sqyxBaseServer.dysr(concondzput) ;
                }
                if (concondzfh.equals("小于")) {
                    putput = sqyxBaseServer.xysr(concondzput) ;
                }
                concondzcountage = hdhd + putput ;

            } else {
                concon = null;
                concondzfh = null;
                concondzput = null;
            }


            String membergrade = null;

            membergrade = jsonObject.getString("membergrade");


            String cp = null;

            cp = jsonObject.getString("preference");

            String topiclike = null;
            String fwstarttimes = null;
            String fwendtimes = null;
            int fwfw = 0 ;
            JSONObject fwtime = null;
            fwtime = jsonObject.getJSONObject("访问时间");
            if (fwtime != null) {
                Date starttime = fwtime.getDate("starttime");
                Date endtime = fwtime.getDate("endtime");
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                fwstarttimes = sdf.format(starttime);
                fwendtimes = sdf.format(endtime);
                fwfw = sqyxBaseServer.counttabone1(fwstarttimes, fwendtimes);


            } else {
                fwstarttimes = null;
                fwendtimes = null;
                fwtime = null;

            }

            String zcstarttimes = null;
            String zcendtimes = null;
            int zczc = 0;
            JSONObject zctime = null;
            zctime = jsonObject.getJSONObject("注册时间");
            if (zctime != null) {
                Date starttime = zctime.getDate("starttime");
                Date endtime = zctime.getDate("endtime");
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                zcstarttimes = sdf.format(starttime);
                zcendtimes = sdf.format(endtime);
                zczc = sqyxBaseServer.counttabone2(zcstarttimes, zcendtimes);
                System.out.println(zczc+"+++++++++++++++++++++++++++++++++");


            } else {
                zcstarttimes = null;
                zcendtimes = null;
                zctime = null;

            }

            String xq = null;
            xq = jsonObject.getString("需求偏好");

            JSONObject sr = null;
            sr = jsonObject.getJSONObject("收入");
            String srfh = null;
            Integer srput = null;
            int srcount = 0;

            if (sr != null) {
                //拿到put
                srfh = sr.getString("fh");
                srput = sr.getInteger("put");
                System.out.println(srfh);
                System.out.println(srput);
                int srcountfh = 0;
                int srcountput = 0;

                if (srfh.equals("大于")) {
                    srcountfh = sqyxBaseServer.dysr(srput) ;
                }
                if (srfh.equals("小于")) {
                    srcountput = sqyxBaseServer.xysr(srput) ;
                }
                srcount = srcountfh + srcountput ;
                System.out.println(srcount);
            } else {
                sr = null;
                srfh = null;
                srput = null;
            }

            //第1个属性 新增
            JSONObject news = null;
            String newsstarttimes = null;
            String newsendtimes = null;
            news = jsonObject.getJSONObject("newlyadded");
            if (news != null) {
                Date starttime = news.getDate("starttime");
                Date endtime = news.getDate("endtime");
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                newsstarttimes = sdf.format(starttime);
                newsendtimes = sdf.format(endtime);


            } else {
                newsstarttimes = null;
                newsendtimes = null;


            }

            //第2个属性 发言
            JSONObject speak = null;
            speak = jsonObject.getJSONObject("speak");
            String speakstarttimes = null;
            String speakendtimes = null;
            if (speak != null) {
                Date starttime = speak.getDate("starttime");
                Date endtime = speak.getDate("endtime");
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                speakstarttimes = sdf.format(starttime);
                speakendtimes = sdf.format(endtime);


            } else {
                speakstarttimes = null;
                speakendtimes = null;
            }

            //第3个属性 签到
            JSONObject signin = null;
            signin = jsonObject.getJSONObject("signin");
            String signinstarttimes = null;
            String signinendtimes = null;
            if (signin != null) {
                Date starttime = signin.getDate("starttime");
                Date endtime = signin.getDate("endtime");
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                signinstarttimes = sdf.format(starttime);
                signinendtimes = sdf.format(endtime);
                //int findCountnew = sqyxBaseServer.findCountnew(starttimes, endtimes);

            } else {
                signinstarttimes = null;
                signinendtimes = null;

            }
            //第4个属性 话题发起
            JSONObject ci = null;
            ci = jsonObject.getJSONObject("topicinitiation");
            String cistarttimes = null;
            String ciendtimes = null;
            if (ci != null) {
                Date starttime = ci.getDate("starttime");
                Date endtime = ci.getDate("endtime");
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                cistarttimes = sdf.format(starttime);
                ciendtimes = sdf.format(endtime);
                //int findCountnew = sqyxBaseServer.findCountnew(starttimes, endtimes);

            } else {
                cistarttimes = null;
                ciendtimes = null;
                //countci = 0;

            }

            //第5个属性 分享
            JSONObject share = null;
            share = jsonObject.getJSONObject("share");
            int countshare = 0;
            String sharestarttimes = null;
            String shareendtimes = null;
            if (share != null) {
                Date starttime = share.getDate("starttime");
                Date endtime = share.getDate("endtime");
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                sharestarttimes = sdf.format(starttime);
                shareendtimes = sdf.format(endtime);
                //int findCountnew = sqyxBaseServer.findCountnew(starttimes, endtimes);
                //countshare = findCountnew;

            } else {
                sharestarttimes = null;
                shareendtimes = null;
                //countshare = 0;
            }

            //先统计出 属性的 人数
/*
            int countab = sqyxBaseServer.findCountab(sex, membergrade, cp, startsp, endsp, profession,
                    area, constellation, max, small, dzmax, dzsmall, htmax, htsmall,
                    fwstarttimes, fwendtimes, zcstarttimes, zcendtimes,
                    kdjmax, kdjsmall, hymax, hysmall, xq, newsstarttimes, newsendtimes,
                    speakstarttimes, speakendtimes, signinstarttimes, signinendtimes, cistarttimes, ciendtimes,
                    sharestarttimes, shareendtimes);
*/

            int counttabone = sqyxBaseServer.counttabone(fwstarttimes, fwendtimes, zcstarttimes, zcendtimes);


            System.out.println(countage);
            System.out.println(srcount);
            //计算出全部值
            int num = countage+srcount+hdcountage+dzcountage+fqfqdzcountage+kdkddzcountage+hyhydzcountage+concondzcountage+fwfw+zczc;

            //将所有字段保存

            //获取用户id
            //拿到规则名称
            String labname = null;
            labname = jsonObject.getString("labname");
            int id = u.getId();
            SqyxLabel sqyxLabel = new SqyxLabel();


            sqyxLabel.setCheadid(cheadid);
            sqyxLabel.setLabelname(labelname);
            sqyxLabel.setRemark(remark);
            sqyxLabel.setCounts(num);
            sqyxLabel.setConditions(data);
            sqyxLabel.setType(type);
            sqyxLabel.setUserid(id);
            sqyxLabel.setLabname(labname);

            try {
                sqyxLabelServer.insertLabel(sqyxLabel);
            } catch (Exception e) {
                e.printStackTrace();

                return ResultBean.error("标签已经存在,请重新创建");
            }
            return ResultBean.success("标签创建成功", num);

        } catch (Exception e) {
            e.printStackTrace();

            return ResultBean.error("标签创建失败");
        }

    }


    /*
     *  新增 发言
     *功能描述 存入标签
     * @author lzb
     * @date 2022/1/18
     * @param
     * @return
     */
    @RequestMapping("createCommunityUserTagsTwo")
    @ResponseBody
    public ResultBean createCommunityUserTagsTwo(@RequestBody String data) {

        JSONObject jsonObject = JSON.parseObject(data);
        //新建条件属性
        Integer cheadid = null;
        String labelname = null;
        String remark = null;

        cheadid = jsonObject.getInteger("cheadid");
        labelname = jsonObject.getString("labelname");
        remark = jsonObject.getString("remark");

        JSONObject sex = null;

        sex = jsonObject.getJSONObject("sex");

        Integer type = null;

        type = jsonObject.getInteger("type");


        //对年龄进行判断 拿到
        int countsex = 0;
        if (sex != null) {
            Date starttime = null;
            Date endtime = null;
            String usersr = null;
            String fh = null;
            starttime = sex.getDate("starttime");
            endtime = sex.getDate("endtime");
            usersr = sex.getString("usersr");
            fh = sex.getString("fu");
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            String starttimes = sdf.format(starttime);
            String endtimes = sdf.format(endtime);
            if (fh.equals("=")) {

                int findCountnew = sqyxBaseServer.finsjsex1(usersr, starttimes, endtimes);
                countsex = findCountnew;


            }
            if (fh.equals(">")) {

                int findCountnew = 0;
                countsex = findCountnew;


            }
            if (fh.equals("<")) {

                int findCountnew = 0;
                countsex = findCountnew;


            }

        } else {
            String starttimes = null;
            String endtimes = null;
            countsex = 0;
        }


        JSONObject constellation = null;

        constellation = jsonObject.getJSONObject("constellation");

        //对年龄进行判断 拿到
        int countconstellation = 0;
        if (constellation != null) {
            Date starttime = null;
            Date endtime = null;
            String usersr = null;
            String fh = null;
            starttime = constellation.getDate("starttime");
            endtime = constellation.getDate("endtime");
            usersr = constellation.getString("usersr");
            fh = constellation.getString("fu");
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            String starttimes = sdf.format(starttime);
            String endtimes = sdf.format(endtime);
            if (fh.equals("=")) {

                int findCountnew = sqyxBaseServer.finsjcon1(usersr, starttimes, endtimes);
                countconstellation = findCountnew;


            }
            if (fh.equals(">")) {

                int findCountnew = 0;
                countconstellation = findCountnew;


            }
            if (fh.equals("<")) {

                int findCountnew = 0;
                countconstellation = findCountnew;


            }

        } else {
            String starttimes = null;
            String endtimes = null;
            countconstellation = 0;
        }


        JSONObject education = null;

        education = jsonObject.getJSONObject("education");

        //对年龄进行判断 拿到
        int edu = 0;
        if (education != null) {
            Date starttime = null;
            Date endtime = null;
            String usersr = null;
            String fh = null;
            starttime = education.getDate("starttime");
            endtime = education.getDate("endtime");
            usersr = education.getString("usersr");
            fh = education.getString("fu");
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            String starttimes = sdf.format(starttime);
            String endtimes = sdf.format(endtime);
            if (fh.equals("=")) {

                int findCountnew = sqyxBaseServer.finsjedu1(usersr, starttimes, endtimes);
                edu = findCountnew;


            }
            if (fh.equals(">")) {

                int findCountnew = 0;
                edu = findCountnew;


            }
            if (fh.equals("<")) {

                int findCountnew = 0;
                edu = findCountnew;


            }

        } else {
            String starttimes = null;
            String endtimes = null;
            edu = 0;
        }


        JSONObject area = null;

        area = jsonObject.getJSONObject("area");

        //对年龄进行判断 拿到
        int areas = 0;
        if (area != null) {
            Date starttime = null;
            Date endtime = null;
            String usersr = null;
            String fh = null;
            starttime = area.getDate("starttime");
            endtime = area.getDate("endtime");
            usersr = area.getString("usersr");
            fh = area.getString("fu");
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            String starttimes = sdf.format(starttime);
            String endtimes = sdf.format(endtime);
            if (fh.equals("=")) {

                int findCountnew = sqyxBaseServer.finsjarea1(usersr, starttimes, endtimes);
                areas = findCountnew;


            }
            if (fh.equals(">")) {

                int findCountnew = 0;
                areas = findCountnew;


            }
            if (fh.equals("<")) {

                int findCountnew = 0;
                areas = findCountnew;


            }

        } else {
            String starttimes = null;
            String endtimes = null;
            areas = 0;
        }

        JSONObject channel = null;

        channel = jsonObject.getJSONObject("channel");

        //对年龄进行判断 拿到
        int cha = 0;
        if (channel != null) {
            Date starttime = null;
            Date endtime = null;
            String usersr = null;
            String fh = null;
            starttime = channel.getDate("starttime");
            endtime = channel.getDate("endtime");
            usersr = channel.getString("usersr");
            fh = channel.getString("fu");
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            String starttimes = sdf.format(starttime);
            String endtimes = sdf.format(endtime);
            if (fh.equals("=")) {

                int findCountnew = sqyxBaseServer.finsjcha1(usersr, starttimes, endtimes);
                cha = findCountnew;


            }
            if (fh.equals(">")) {

                int findCountnew = 0;
                cha = findCountnew;


            }
            if (fh.equals("<")) {

                int findCountnew = 0;
                cha = findCountnew;


            }

        } else {
            String starttimes = null;
            String endtimes = null;
            cha = 0;
        }


        JSONObject signin = null;

        signin = jsonObject.getJSONObject("signin");

        //对年龄进行判断 拿到
        int sig = 0;
        if (signin != null) {
            Date starttime = null;
            Date endtime = null;
            String usersr = null;
            String fh = null;
            starttime = signin.getDate("starttime");
            endtime = signin.getDate("endtime");
            usersr = signin.getString("usersr");
            fh = signin.getString("fu");
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            String starttimes = sdf.format(starttime);
            String endtimes = sdf.format(endtime);
            if (fh.equals("=")) {

                int findCountnew = sqyxBaseServer.finsjsig1(usersr, starttimes, endtimes);
                sig = findCountnew;


            }
            if (fh.equals(">")) {

                int findCountnew = 0;
                sig = findCountnew;


            }
            if (fh.equals("<")) {

                int findCountnew = 0;
                sig = findCountnew;


            }

        } else {
            String starttimes = null;
            String endtimes = null;
            sig = 0;
        }

        JSONObject member = null;

        member = jsonObject.getJSONObject("member");

        //对年龄进行判断 拿到
        int mem = 0;
        if (member != null) {
            Date starttime = null;
            Date endtime = null;
            String usersr = null;
            String fh = null;
            starttime = member.getDate("starttime");
            endtime = member.getDate("endtime");
            usersr = member.getString("usersr");
            fh = member.getString("fu");
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            String starttimes = sdf.format(starttime);
            String endtimes = sdf.format(endtime);
            if (fh.equals("=")) {

                int findCountnew = sqyxBaseServer.finsjmem1(usersr, starttimes, endtimes);
                mem = findCountnew;


            }
            if (fh.equals(">")) {

                int findCountnew = 0;
                mem = findCountnew;


            }
            if (fh.equals("<")) {

                int findCountnew = 0;
                mem = findCountnew;


            }

        } else {
            String starttimes = null;
            String endtimes = null;
            mem = 0;
        }

        JSONObject membergrade = null;

        membergrade = jsonObject.getJSONObject("membergrade");

        //对年龄进行判断 拿到
        int memb = 0;
        if (membergrade != null) {
            Date starttime = null;
            Date endtime = null;
            String usersr = null;
            String fh = null;
            starttime = membergrade.getDate("starttime");
            endtime = membergrade.getDate("endtime");
            usersr = membergrade.getString("usersr");
            fh = membergrade.getString("fu");
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            String starttimes = sdf.format(starttime);
            String endtimes = sdf.format(endtime);
            if (fh.equals("=")) {

                int findCountnew = sqyxBaseServer.finsjmemb1(usersr, starttimes, endtimes);
                memb = findCountnew;


            }
            if (fh.equals(">")) {

                int findCountnew = 0;
                memb = findCountnew;


            }
            if (fh.equals("<")) {

                int findCountnew = 0;
                memb = findCountnew;


            }

        } else {
            String starttimes = null;
            String endtimes = null;
            memb = 0;
        }


        JSONObject look = null;

        look = jsonObject.getJSONObject("look");

        //对年龄进行判断 拿到
        int lo = 0;
        if (look != null) {
            Date starttime = null;
            Date endtime = null;
            String usersr = null;
            String fh = null;
            starttime = look.getDate("starttime");
            endtime = look.getDate("endtime");
            usersr = look.getString("usersr");
            fh = look.getString("fu");
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            String starttimes = sdf.format(starttime);
            String endtimes = sdf.format(endtime);
            if (fh.equals("=")) {

                int findCountnew = sqyxBaseServer.findCountnewbuy(usersr, starttimes, endtimes);
                lo = findCountnew;


            }
            if (fh.equals(">")) {

                int findCountnew = sqyxBaseServer.findCountnewbuybig(usersr, starttimes, endtimes);
                lo = findCountnew;


            }
            if (fh.equals("<")) {

                int findCountnew = sqyxBaseServer.findCountnewbuysmall(usersr, starttimes, endtimes);
                lo = findCountnew;


            }

        } else {
            String starttimes = null;
            String endtimes = null;
            lo = 0;
        }

        JSONObject buy = null;

        buy = jsonObject.getJSONObject("buy");

        //对年龄进行判断 拿到
        int buys = 0;
        if (buy != null) {
            Date starttime = null;
            Date endtime = null;
            String usersr = null;
            String fh = null;
            starttime = buy.getDate("starttime");
            endtime = buy.getDate("endtime");
            usersr = buy.getString("usersr");
            fh = buy.getString("fu");
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            String starttimes = sdf.format(starttime);
            String endtimes = sdf.format(endtime);
            if (fh.equals("=")) {

                int findCountnew = sqyxBaseServer.findCountnewbuy(usersr, starttimes, endtimes);
                buys = findCountnew;


            }
            if (fh.equals(">")) {

                int findCountnew = sqyxBaseServer.findCountnewbuybig(usersr, starttimes, endtimes);
                buys = findCountnew;


            }
            if (fh.equals("<")) {

                int findCountnew = sqyxBaseServer.findCountnewbuysmall(usersr, starttimes, endtimes);
                buys = findCountnew;


            }

        } else {
            String starttimes = null;
            String endtimes = null;
            buys = 0;
        }

        JSONObject lb = null;

        lb = jsonObject.getJSONObject("lb");

        //对年龄进行判断 拿到
        int lbs = 0;
        if (lb != null) {
            Date starttime = null;
            Date endtime = null;
            String usersr = null;
            String fh = null;
            starttime = lb.getDate("starttime");
            endtime = lb.getDate("endtime");
            usersr = lb.getString("usersr");
            fh = lb.getString("fu");
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            String starttimes = sdf.format(starttime);
            String endtimes = sdf.format(endtime);
            if (fh.equals("=")) {

                int findCountnew = sqyxBaseServer.findCountlb1(usersr, starttimes, endtimes);
                lbs = findCountnew;


            }
            if (fh.equals(">")) {

                int findCountnew = 0;
                lbs = findCountnew;


            }
            if (fh.equals("<")) {

                int findCountnew = 0;
                lbs = findCountnew;


            }

        } else {
            String starttimes = null;
            String endtimes = null;
            lbs = 0;
        }

        //计算出全部值
        int num = countsex + countconstellation + areas + edu + cha + sig + mem + memb + lo + buys + lbs;

        //将所有字段保存

        SqyxLabel sqyxLabel = new SqyxLabel();

        sqyxLabel.setCheadid(cheadid);
        sqyxLabel.setLabelname(labelname);
        sqyxLabel.setRemark(remark);
        sqyxLabel.setCounts(num);
        sqyxLabel.setConditions(data);
        sqyxLabel.setType(type);
        try {
            sqyxLabelServer.insertLabel(sqyxLabel);
        } catch (Exception e) {
            e.printStackTrace();

            return ResultBean.error("标签名字已经存在");
        }
        return ResultBean.success("标签创建成功", num);

    }

    /*
     *
     *功能描述 点击标签分析页面 条件 consumption
     * @author lzb
     * @date 2022/1/19
     * @param
     * @return
     */
    @RequestMapping("clickOnTheTagAnalysisPageOne")
    @ResponseBody
    public ResultBean clickOnTheTagAnalysisPageOne(@RequestBody String data) {

        JSONObject jsonObject = JSON.parseObject(data);
        String labelname = null;
        labelname = jsonObject.getString("labelname");
        System.out.println(labelname);


        SqyxLabel findallbyname = sqyxLabelServer.findAllByname(labelname);


             int type ;
             type = findallbyname.getType();

        //自定义创建
        if (type == 0) {
            String conditions = findallbyname.getConditions();

            ArrayList<Object> objects = new ArrayList<>();

            JSONObject con = JSON.parseObject(conditions);

            String zy = con.getString("职业");
            if (zy != null) {
                objects.add("职业: " + zy);
            }

            String cs = con.getString("城市");
            if (cs != null) {
                objects.add("城市: " + cs);
            }

            String xz = con.getString("星座");
            if (xz != null) {
                objects.add("星座: " + xz);
            }

            JSONObject hd = null;
            hd     = con.getJSONObject("活动参与度");
            if (hd != null) {
                String hdfh = null;
                hdfh = hd.getString("fh");
                Integer hdput = null;
                hdput = hd.getInteger("put");
                objects.add("活动参与度: " + hdfh + "  " + hdput );
            }
            JSONObject dzl = null ;
            dzl     = con.getJSONObject("点赞率");
            if (dzl != null) {
                String dzfh = null;
                dzfh = dzl.getString("fh");
                Integer dzput = null;
                dzput = dzl.getInteger("put");
                objects.add("点赞率: " + dzfh + "  " + dzput );
            }

            JSONObject htht = null ;
            htht     = con.getJSONObject("话题发起");
            if (htht != null) {
                String dzfh = null;
                dzfh = htht.getString("fh");
                Integer dzput = null;
                dzput = htht.getInteger("put");
                objects.add("话题发起: " + dzfh + "  " + dzput );
            }


            JSONObject kdj = null;
            kdj     = con.getJSONObject("客单价");
            if (kdj != null) {
                String fh = null;
                fh = kdj.getString("fh");
                Integer put = null;
               put = kdj.getInteger("put");
                objects.add("客单价: " + fh + "  " + put + "¥");
            }

            JSONObject hyhy = null;
            hyhy     = con.getJSONObject("消费活跃用户");
            if (hyhy != null) {
                String fh = null;
                fh = hyhy.getString("fh");
                Integer put = null;
                put = hyhy.getInteger("put");
                objects.add("消费活跃用户: " + fh + "  " + put + "人");
            }

            JSONObject consumption = null;
            consumption     = con.getJSONObject("consumption");
            if (consumption != null) {
                String fh = null;
                fh = consumption.getString("fh");
                Integer put = null;
                put = consumption.getInteger("put");
                objects.add("消费能力: " + fh + "  " + put + "¥");
            }




            String sex = con.getString("sex");


            if (sex != null) {
                objects.add("性别: " + sex);
            }

            String membergrade = con.getString("membergrade");

            if (membergrade != null) {
                objects.add("会员等级: " + membergrade);
            }

            JSONObject age = null;
            age = con.getJSONObject("age");


            if (age != null) {
                String agefh = null;
                 agefh = age.getString("fh");
                Integer ageput = null;
                 ageput = age.getInteger("put");
                objects.add("年龄: " + agefh + "  " + ageput + "岁");
            }

            JSONObject sr = null;
            sr = con.getJSONObject("收入");
            if (sr != null) {
                String srfh = sr.getString("fh");
                Integer srput = sr.getInteger("put");
                objects.add("收入: " + srfh + "  " + srput + "¥");
            }

            String preference = con.getString("preference");

            if (preference != null) {
                objects.add("产品类型: " + preference);
            }

            String xq = con.getString("需求偏好");

            if (xq != null) {
                objects.add("需求偏好: " + xq);
            }

            JSONObject fwtime = null;
            fwtime = con.getJSONObject("访问时间");


            if (fwtime != null) {
                Date starttime = fwtime.getDate("starttime");
                Date endtime = fwtime.getDate("endtime");
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                String starttimes = sdf.format(starttime);
                String endtimes = sdf.format(endtime);
                objects.add("用户在" + starttimes + "~" + endtimes + "进行访问");
            }

            JSONObject zctime = null;
            zctime = con.getJSONObject("注册时间");


            if (zctime != null) {
                Date starttime = zctime.getDate("starttime");
                Date endtime = zctime.getDate("endtime");
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                String starttimes = sdf.format(starttime);
                String endtimes = sdf.format(endtime);
                objects.add("用户在" + starttimes + "~" + endtimes + "进行注册");
            }


            JSONObject news = null;
            news = con.getJSONObject("newlyadded");


            if (news != null) {
                Date starttime = news.getDate("starttime");
                Date endtime = news.getDate("endtime");
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                String starttimes = sdf.format(starttime);
                String endtimes = sdf.format(endtime);
                objects.add("用户在" + starttimes + "~" + endtimes + "做出新增行为");
            }

            JSONObject speak = null;
            speak = con.getJSONObject("speak");


            if (speak != null) {
                Date starttime = speak.getDate("starttime");
                Date endtime = speak.getDate("endtime");
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                String starttimes = sdf.format(starttime);
                String endtimes = sdf.format(endtime);
                objects.add("用户在" + starttimes + "~" + endtimes + "做出发言行为");
            }


            JSONObject signin = null;
            signin = con.getJSONObject("signin");

            if (signin != null) {
                Date starttime = signin.getDate("starttime");
                Date endtime = signin.getDate("endtime");
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                String starttimes = sdf.format(starttime);
                String endtimes = sdf.format(endtime);
                objects.add("用户在" + starttimes + "~" + endtimes + "做出发言行为");
            }

            JSONObject topicinitiation = null;
            topicinitiation = con.getJSONObject("topicinitiation");

            if (topicinitiation != null) {
                Date starttime = topicinitiation.getDate("starttime");
                Date endtime = topicinitiation.getDate("endtime");
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                String starttimes = sdf.format(starttime);
                String endtimes = sdf.format(endtime);
                objects.add("用户在" + starttimes + "~" + endtimes + "做出话题发起行为");
            }

            JSONObject share = null;
            share = con.getJSONObject("share");


            if (share != null) {
                Date starttime = share.getDate("starttime");
                Date endtime = share.getDate("endtime");
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                String starttimes = sdf.format(starttime);
                String endtimes = sdf.format(endtime);
                objects.add("用户在" + starttimes + "~" + endtimes + "做出分享行为");
            }

            findallbyname.setTj(objects);


            return ResultBean.success(findallbyname);


        }
        //事件偏好创建
        if (type == 1) {
            ArrayList<Object> objects = new ArrayList<>();
            String conditions = findallbyname.getConditions();


            JSONObject con = JSON.parseObject(conditions);

            JSONObject sex = null;

            sex = con.getJSONObject("sex");

            if (sex != null) {
                Date starttime = null;
                Date endtime = null;
                String fh = null;
                starttime = sex.getDate("starttime");
                endtime = sex.getDate("endtime");
                fh = sex.getString("fu");
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                String starttimes = sdf.format(starttime);
                String endtimes = sdf.format(endtime);
                String usersr = sex.getString("usersr");
                objects.add("性别: " + usersr + " 筛选时间范围:" + starttimes + "~" + endtimes);
            }

            JSONObject constellation = null;

            constellation = con.getJSONObject("constellation");

            if (constellation != null) {
                Date starttime = null;
                Date endtime = null;
                String fh = null;
                starttime = constellation.getDate("starttime");
                endtime = constellation.getDate("endtime");
                fh = constellation.getString("fu");
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                String starttimes = sdf.format(starttime);
                String endtimes = sdf.format(endtime);
                String usersr = constellation.getString("usersr");
                objects.add("星座: " + usersr + " 筛选时间范围:" + starttimes + "~" + endtimes);
            }

            JSONObject education = null;

            education = con.getJSONObject("education");

            if (education != null) {
                Date starttime = null;
                Date endtime = null;
                String fh = null;
                starttime = education.getDate("starttime");
                endtime = education.getDate("endtime");
                fh = education.getString("fu");
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                String starttimes = sdf.format(starttime);
                String endtimes = sdf.format(endtime);
                String usersr = education.getString("usersr");
                objects.add("学历: " + usersr + " 筛选时间范围:" + starttimes + "~" + endtimes);
            }

            JSONObject area = null;

            area = con.getJSONObject("area");

            if (area != null) {
                Date starttime = null;
                Date endtime = null;
                String fh = null;
                starttime = area.getDate("starttime");
                endtime = area.getDate("endtime");
                fh = area.getString("fu");
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                String starttimes = sdf.format(starttime);
                String endtimes = sdf.format(endtime);
                String usersr = area.getString("usersr");
                objects.add("地区: " + usersr + " 筛选时间范围:" + starttimes + "~" + endtimes);
            }
            JSONObject channel = null;

            channel = con.getJSONObject("channel");

            if (channel != null) {
                Date starttime = null;
                Date endtime = null;
                String fh = null;
                starttime = channel.getDate("starttime");
                endtime = channel.getDate("endtime");
                fh = channel.getString("fu");
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                String starttimes = sdf.format(starttime);
                String endtimes = sdf.format(endtime);
                String usersr = channel.getString("usersr");
                objects.add("渠道: " + usersr + " 筛选时间范围:" + starttimes + "~" + endtimes);
            }

            JSONObject signin = null;

            signin = con.getJSONObject("signin");

            if (signin != null) {
                Date starttime = null;
                Date endtime = null;
                String fh = null;
                starttime = signin.getDate("starttime");
                endtime = signin.getDate("endtime");
                fh = signin.getString("fu");
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                String starttimes = sdf.format(starttime);
                String endtimes = sdf.format(endtime);
                String usersr = signin.getString("usersr");
                objects.add("签到: " + usersr + " 筛选时间范围:" + starttimes + "~" + endtimes);
            }


            JSONObject member = null;

            member = con.getJSONObject("member");

            if (member != null) {
                Date starttime = null;
                Date endtime = null;
                String fh = null;
                starttime = member.getDate("starttime");
                endtime = member.getDate("endtime");
                fh = member.getString("fu");
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                String starttimes = sdf.format(starttime);
                String endtimes = sdf.format(endtime);
                String usersr = member.getString("usersr");
                objects.add("会员: " + usersr + " 筛选时间范围:" + starttimes + "~" + endtimes);
            }

            JSONObject membergrade = null;

            membergrade = con.getJSONObject("membergrade");

            if (membergrade != null) {
                Date starttime = null;
                Date endtime = null;
                String fh = null;
                starttime = membergrade.getDate("starttime");
                endtime = membergrade.getDate("endtime");
                fh = membergrade.getString("fu");
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                String starttimes = sdf.format(starttime);
                String endtimes = sdf.format(endtime);
                String usersr = membergrade.getString("usersr");
                objects.add("会员等级: " + usersr + " 筛选时间范围:" + starttimes + "~" + endtimes);
            }

            JSONObject look = null;

            look = con.getJSONObject("look");

            if (look != null) {
                Date starttime = null;
                Date endtime = null;
                String fh = null;
                starttime = look.getDate("starttime");
                endtime = look.getDate("endtime");
                fh = look.getString("fu");
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                String starttimes = sdf.format(starttime);
                String endtimes = sdf.format(endtime);
                String usersr = look.getString("usersr");
                objects.add("浏览次数" + fh + usersr + " 筛选时间范围:" + starttimes + "~" + endtimes);
            }

            JSONObject buy = null;

            buy = con.getJSONObject("buy");

            if (buy != null) {
                Date starttime = null;
                Date endtime = null;
                String fh = null;
                starttime = buy.getDate("starttime");
                endtime = buy.getDate("endtime");
                fh = buy.getString("fu");
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                String starttimes = sdf.format(starttime);
                String endtimes = sdf.format(endtime);
                String usersr = buy.getString("usersr");
                objects.add("购买次数" + fh + usersr + " 筛选时间范围:" + starttimes + "~" + endtimes);

            }

            JSONObject lb = null;

            lb = con.getJSONObject("lb");

            if (lb != null) {
                Date starttime = null;
                Date endtime = null;
                String fh = null;
                starttime = buy.getDate("starttime");
                endtime = buy.getDate("endtime");
                fh = buy.getString("fu");
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                String starttimes = sdf.format(starttime);
                String endtimes = sdf.format(endtime);
                String usersr = buy.getString("usersr");
                objects.add("产品类别: " + usersr + " 筛选时间范围:" + starttimes + "~" + endtimes);

            }


            findallbyname.setTj(objects);
            if(findallbyname.getLabelname().equals("属性类标签")){
                findallbyname.setLabname("");
                findallbyname.setRemark("");


                return ResultBean.success(findallbyname);

            }

            return ResultBean.success(findallbyname);

        }
        if(type == 2){
            SqyxLabel sqyxLabel = new SqyxLabel();
            sqyxLabel.setLabname("");
            sqyxLabel.setRemark("");
            return ResultBean.success(sqyxLabel);
        }

        if(findallbyname.getLabelname().equals("属性类标签")) {
            findallbyname.setLabname("");
            findallbyname.setRemark("");
            return ResultBean.success(findallbyname);
        }

        return ResultBean.success(findallbyname);

    }

    public static String removeCharAt(String s, int pos) {
        return s.substring(0, pos) + s.substring(pos + 1);
    }


    /*
     *
     *功能描述 displayLabelOne 展示标签
     * @author lzb
     * @date 2022/1/19
     * @param
     * @return
     */
    @RequestMapping("displayLabelOne")
    @ResponseBody
    public ResultBean displayLabelOne(HttpServletRequest request) {
        String token = request.getHeader("Authorization");
        String jwt = token.substring(token.lastIndexOf(" ") + 1);
        User u = JwtUtil.unsign(jwt, User.class);
        if (u == null) {
            return ResultBean.error("token无效");
        }

        int userid = u.getId();
        System.out.println("============================="+userid);
        //获取到顶级父类
        List<SqyxLabel> girFirstLabel = sqyxLabelServer.girFirstLabel();
        ArrayList<Object> objects = new ArrayList<>();
        for (SqyxLabel part : girFirstLabel
        ) {
            String labelname = part.getLabelname();
            int parentid = part.getParentid();
            FirstLabelVo firstLabelVo = new FirstLabelVo();
            firstLabelVo.setParentid(parentid);
            firstLabelVo.setLabelName(labelname);
            List<CheadVo> gitCheadVo = sqyxLabelServer.gitCheadVo(parentid, userid);
            if (gitCheadVo != null) {
                firstLabelVo.setCheadVo(gitCheadVo);
            }
            objects.add(firstLabelVo);
        }

        return ResultBean.success(objects);

    }

    @RequestMapping("deletelab")
    @ResponseBody
    public ResultBean deletelab(@RequestBody String data,HttpServletRequest request) {


        JSONObject jsonObject = JSON.parseObject(data);
        String labname = jsonObject.getString("labname");
        sqyxLabelServer.deleteLabName(labname);

        return ResultBean.success("成功");
    }


    /*
     *
     *功能描述 displayLabelOne 搜索标签searchTags
     * @author lzb
     * @date 2022/1/19
     * @param
     * @return
     */
    @RequestMapping("searchTags")
    @ResponseBody
    public ResultBean searchTags(@RequestBody String data, HttpServletResponse response, HttpServletRequest request) {
        String token = request.getHeader("Authorization");
        String jwt = token.substring(token.lastIndexOf(" ") + 1);
        User u = JwtUtil.unsign(jwt, User.class);
        if (u == null) {
            return ResultBean.error("token无效");
        }

        int userid = u.getId();

        //拿到标签名称 找到 最子类

        JSONObject jsonObject = JSON.parseObject(data);
        String labname = jsonObject.getString("labname");
        //根据名字 找到parentid
        int findparentid = sqyxLabelServer.findparentid(labname);
        if (findparentid == 0) {
            //查询全部
            String path = "displayLabelOne";
            try {
                response.sendRedirect(path);
            } catch (IOException e) {
                e.printStackTrace();
            }

        }
        //拿到id 找到所有的子类 并且展示
        //按照固定格式返回给前端
        ArrayList<Object> objects = new ArrayList<>();
        FirstLabelVo firstLabelVo = new FirstLabelVo();
        firstLabelVo.setParentid(findparentid);
        firstLabelVo.setLabelName(labname);
        List<CheadVo> gitCheadVo = sqyxLabelServer.gitCheadVo(findparentid, userid);
        firstLabelVo.setCheadVo(gitCheadVo);
        objects.add(firstLabelVo);
        return ResultBean.success(objects);
    }


    /*
     *
     *功能描述 根据用户id查看画像 View portrait by user ID
     * @author lzb
     * @date 2022/1/17
     * @param
     * @return
     */
    @RequestMapping("viewByUserId")
    @ResponseBody
    public ResultBean viewByUserId(@RequestBody String data) {
        JSONObject jsonObject = JSON.parseObject(data);
        int id = jsonObject.getInteger("id");
        SqyxBase sqyxBase = sqyxBaseServer.findAllById(id);


        //进入客单价逻辑判断值

        String productcategoryone = sqyxBase.getProductcategoryone();
       String productcategorytwo = sqyxBase.getProductcategorytwo();
       String  productcategorythree = sqyxBase.getProductcategorythree();
        //价格总和  / 3
        //int as = sqyxBaseServer.findAllkdj(productcategoryone,productcategorytwo,productcategorythree);


        try {

            int a = sqyxBaseServer.findAllkdja(productcategoryone);
            int b = sqyxBaseServer.findAllkdjb(productcategorytwo);
            int c = sqyxBaseServer.findAllkdjc(productcategorythree);
            int last = a + b + c;

            sqyxBase.setKdj(last / 3);

            return ResultBean.success(sqyxBase);
        }catch (Exception e){

            sqyxBase.setKdj(0);

            return ResultBean.success(sqyxBase);
        }


    }

    @RequestMapping("creategroupportrait")
    @ResponseBody
    public ResultBean creategroupportrait(@RequestBody String data,HttpServletRequest request) {
        String token = request.getHeader("Authorization");
        String jwt = token.substring(token.lastIndexOf(" ") + 1);
        User u = JwtUtil.unsign(jwt, User.class);
        if (u == null) {
            return ResultBean.error("token无效");
        }

        //汇总name
        ArrayList<String> objectsAll = new ArrayList<>();

        JSONObject jsonObject = JSON.parseObject(data);
        String labelname = jsonObject.getString("labelname");

        //双标签 age 和 收入

        if(jsonObject.getString("age") != null && jsonObject.getString("收入") != null){




            //寻找年龄
            String age = jsonObject.getString("age");
            System.out.println(age);
            LabVo  labVo = sqyxBaseServer.finOneLable(age);
            String condiTions = labVo.getCondiTions();
            JSONObject jsonObject1 = JSON.parseObject(condiTions);
            String age1 = jsonObject1.getString("age");
            System.out.println(age1);
            JSONObject jsonObject2 = JSON.parseObject(age1);
            String fhs = jsonObject2.getString("fh");
            String fh = "";
            if(fhs.equals("大于")){
                fh = ">";
            }
            if(fhs.equals("小于")){
                fh = "<";
            }
            Integer put = jsonObject2.getInteger("put");
            System.out.println(put);
            //找到所有的name 去重
            //寻找年龄
            String sr = jsonObject.getString("收入");
            LabVo  labVos = sqyxBaseServer.finOneLable(sr);
            String condiTionss = labVos.getCondiTions();
            JSONObject jsonObject22 = JSON.parseObject(condiTionss);
            String age2 = jsonObject22.getString("收入");
            JSONObject jsonObject3 = JSON.parseObject(age2);
            String fhss = jsonObject3.getString("fh");
            String fh2 = "";
            if(fhss.equals("大于")){
                fh2 = ">";
            }
            if(fhss.equals("小于")){
                fh2 = "<";
            }
            Integer put2 = jsonObject3.getInteger("put");


            List<SqyxBase> finAllName = sqyxBaseServer.selectAgeandSr(fh,put,fh2,put2);
            System.out.println(finAllName.size() + "-----------------------");
            for (SqyxBase as:finAllName
            ) {
                String name = as.getName();
                objectsAll.add(name);

            }
            System.out.println("end");

        }


        //双标签 age 和 客单价

        if(jsonObject.getString("age") != null && jsonObject.getString("客单价") != null){




            //寻找年龄
            String age = jsonObject.getString("age");
            System.out.println(age);
            LabVo  labVo = sqyxBaseServer.finOneLable(age);
            String condiTions = labVo.getCondiTions();
            JSONObject jsonObject1 = JSON.parseObject(condiTions);
            String age1 = jsonObject1.getString("age");
            System.out.println(age1);
            JSONObject jsonObject2 = JSON.parseObject(age1);
            String fhs = jsonObject2.getString("fh");
            String fh = "";
            if(fhs.equals("大于")){
                fh = ">";
            }
            if(fhs.equals("小于")){
                fh = "<";
            }
            Integer put = jsonObject2.getInteger("put");
            System.out.println(put);
            //找到所有的name 去重
            //寻找年龄
            String sr = jsonObject.getString("客单价");
            LabVo  labVos = sqyxBaseServer.finOneLable(sr);
            String condiTionss = labVos.getCondiTions();
            JSONObject jsonObject22 = JSON.parseObject(condiTionss);
            String age2 = jsonObject22.getString("客单价");
            JSONObject jsonObject3 = JSON.parseObject(age2);
            String fhss = jsonObject3.getString("fh");
            String fh2 = "";
            if(fhss.equals("大于")){
                fh2 = ">";
            }
            if(fhss.equals("小于")){
                fh2 = "<";
            }
            Integer put2 = jsonObject3.getInteger("put");


            List<SqyxBase> finAllName = sqyxBaseServer.selectAgeandSr2(fh,put,fh2,put2);
            System.out.println(finAllName.size() + "-----------------------");
            for (SqyxBase as:finAllName
            ) {
                String name = as.getName();
                objectsAll.add(name);

            }
            System.out.println("end");

        }

        //双标签 age 和 点赞率

        if(jsonObject.getString("age") != null && jsonObject.getString("点赞率") != null){




            //寻找年龄
            String age = jsonObject.getString("age");
            System.out.println(age);
            LabVo  labVo = sqyxBaseServer.finOneLable(age);
            String condiTions = labVo.getCondiTions();
            JSONObject jsonObject1 = JSON.parseObject(condiTions);
            String age1 = jsonObject1.getString("age");
            System.out.println(age1);
            JSONObject jsonObject2 = JSON.parseObject(age1);
            String fhs = jsonObject2.getString("fh");
            String fh = "";
            if(fhs.equals("大于")){
                fh = ">";
            }
            if(fhs.equals("小于")){
                fh = "<";
            }
            Integer put = jsonObject2.getInteger("put");
            System.out.println(put);
            //找到所有的name 去重
            //寻找年龄
            String sr = jsonObject.getString("点赞率");
            LabVo  labVos = sqyxBaseServer.finOneLable(sr);
            String condiTionss = labVos.getCondiTions();
            JSONObject jsonObject22 = JSON.parseObject(condiTionss);
            String age2 = jsonObject22.getString("点赞率");
            JSONObject jsonObject3 = JSON.parseObject(age2);
            String fhss = jsonObject3.getString("fh");
            String fh2 = "";
            if(fhss.equals("大于")){
                fh2 = ">";
            }
            if(fhss.equals("小于")){
                fh2 = "<";
            }
            Integer put2 = jsonObject3.getInteger("put");


            List<SqyxBase> finAllName = sqyxBaseServer.selectAgeandSr3(fh,put,fh2,put2);
            System.out.println(finAllName.size() + "-----------------------");
            for (SqyxBase as:finAllName
            ) {
                String name = as.getName();
                objectsAll.add(name);

            }
            System.out.println("end");

        }



        //双标签 age 和 活动参与度

        if(jsonObject.getString("age") != null && jsonObject.getString("活动参与度") != null){




            //寻找年龄
            String age = jsonObject.getString("age");
            System.out.println(age);
            LabVo  labVo = sqyxBaseServer.finOneLable(age);
            String condiTions = labVo.getCondiTions();
            JSONObject jsonObject1 = JSON.parseObject(condiTions);
            String age1 = jsonObject1.getString("age");
            System.out.println(age1);
            JSONObject jsonObject2 = JSON.parseObject(age1);
            String fhs = jsonObject2.getString("fh");
            String fh = "";
            if(fhs.equals("大于")){
                fh = ">";
            }
            if(fhs.equals("小于")){
                fh = "<";
            }
            Integer put = jsonObject2.getInteger("put");
            System.out.println(put);
            //找到所有的name 去重
            //寻找年龄
            String sr = jsonObject.getString("活动参与度");
            LabVo  labVos = sqyxBaseServer.finOneLable(sr);
            String condiTionss = labVos.getCondiTions();
            JSONObject jsonObject22 = JSON.parseObject(condiTionss);
            String age2 = jsonObject22.getString("活动参与度");
            JSONObject jsonObject3 = JSON.parseObject(age2);
            String fhss = jsonObject3.getString("fh");
            String fh2 = "";
            if(fhss.equals("大于")){
                fh2 = ">";
            }
            if(fhss.equals("小于")){
                fh2 = "<";
            }
            Integer put2 = jsonObject3.getInteger("put");


            List<SqyxBase> finAllName = sqyxBaseServer.selectAgeandSr4(fh,put,fh2,put2);
            System.out.println(finAllName.size() + "-----------------------");
            for (SqyxBase as:finAllName
            ) {
                String name = as.getName();
                objectsAll.add(name);

            }
            System.out.println("end");

        }


        //双标签 age 和 消费活跃用户

        if(jsonObject.getString("age") != null && jsonObject.getString("消费活跃用户") != null){




            //寻找年龄
            String age = jsonObject.getString("age");
            System.out.println(age);
            LabVo  labVo = sqyxBaseServer.finOneLable(age);
            String condiTions = labVo.getCondiTions();
            JSONObject jsonObject1 = JSON.parseObject(condiTions);
            String age1 = jsonObject1.getString("age");
            System.out.println(age1);
            JSONObject jsonObject2 = JSON.parseObject(age1);
            String fhs = jsonObject2.getString("fh");
            String fh = "";
            if(fhs.equals("大于")){
                fh = ">";
            }
            if(fhs.equals("小于")){
                fh = "<";
            }
            Integer put = jsonObject2.getInteger("put");
            System.out.println(put);
            //找到所有的name 去重
            //寻找年龄
            String sr = jsonObject.getString("消费活跃用户");
            LabVo  labVos = sqyxBaseServer.finOneLable(sr);
            String condiTionss = labVos.getCondiTions();
            JSONObject jsonObject22 = JSON.parseObject(condiTionss);
            String age2 = jsonObject22.getString("消费活跃用户");
            JSONObject jsonObject3 = JSON.parseObject(age2);
            String fhss = jsonObject3.getString("fh");
            String fh2 = "";
            if(fhss.equals("大于")){
                fh2 = ">";
            }
            if(fhss.equals("小于")){
                fh2 = "<";
            }
            Integer put2 = jsonObject3.getInteger("put");


            List<SqyxBase> finAllName = sqyxBaseServer.selectAge(fh,put);
            System.out.println(finAllName.size() + "-----------------------");
            for (SqyxBase as:finAllName
            ) {
                String name = as.getName();
                objectsAll.add(name);

            }
            System.out.println("end");

        }


        //lab 年龄
        if(jsonObject.getString("age") != null && jsonObject.getString("sex") == null && jsonObject.getString("收入") == null
                && jsonObject.getString("客单价") == null
                && jsonObject.getString("点赞率") == null
                && jsonObject.getString("活动参与度") == null
                && jsonObject.getString("消费活跃用户") == null){
            //寻找年龄
            String age = jsonObject.getString("age");
            System.out.println(age);
            LabVo  labVo = sqyxBaseServer.finOneLable(age);
            String condiTions = labVo.getCondiTions();
            JSONObject jsonObject1 = JSON.parseObject(condiTions);
            String age1 = jsonObject1.getString("age");
            System.out.println(age1);
            JSONObject jsonObject2 = JSON.parseObject(age1);
            String fhs = jsonObject2.getString("fh");
            String fh = "";
            if(fhs.equals("大于")){
                fh = ">";
            }
            if(fhs.equals("小于")){
                fh = "<";
            }
            Integer put = jsonObject2.getInteger("put");
            System.out.println(put);
            //找到所有的name 去重
            List<SqyxBase> finAllName = sqyxBaseServer.selectAge(fh,put);
            for (SqyxBase as:finAllName
                 ) {
                String name = as.getName();
                objectsAll.add(name);

            }
 
        }

        //lab 年龄 组合 性别
        if(jsonObject.getString("age") != null && jsonObject.getString("sex") != null){
            String sex = jsonObject.getString("sex");



            //寻找年龄
            String age = jsonObject.getString("age");
            System.out.println(age);
            LabVo  labVo = sqyxBaseServer.finOneLable(age);
            String condiTions = labVo.getCondiTions();
            JSONObject jsonObject1 = JSON.parseObject(condiTions);
            String age1 = jsonObject1.getString("age");
            System.out.println(age1);
            JSONObject jsonObject2 = JSON.parseObject(age1);
            String fhs = jsonObject2.getString("fh");
            String fh = "";
            if(fhs.equals("大于")){
                fh = ">";
            }
            if(fhs.equals("小于")){
                fh = "<";
            }
            Integer put = jsonObject2.getInteger("put");
            System.out.println(put);
            //找到所有的name 去重
            List<SqyxBase> finAllName = sqyxBaseServer.selectAgeSex(fh,put,sex);
            for (SqyxBase as:finAllName
            ) {
                String name = as.getName();
                objectsAll.add(name);

            }

        }

        //lab 收入
        if(jsonObject.getString("收入") != null  && jsonObject.getString("sex") == null && jsonObject.getString("age") == null){
            //寻找年龄
            String age = jsonObject.getString("收入");
            LabVo  labVo = sqyxBaseServer.finOneLable(age);
            String condiTions = labVo.getCondiTions();
            JSONObject jsonObject1 = JSON.parseObject(condiTions);
            String age1 = jsonObject1.getString("收入");
            System.out.println(age1);
            JSONObject jsonObject2 = JSON.parseObject(age1);
            String fhs = jsonObject2.getString("fh");
            String fh = "";
            if(fhs.equals("大于")){
                fh = ">";
            }
            if(fhs.equals("小于")){
                fh = "<";
            }
            Integer put = jsonObject2.getInteger("put");
            System.out.println(put);
            //找到所有的name 去重
            List<SqyxBase> finAllName = sqyxBaseServer.selectSru(fh,put);
            for (SqyxBase as:finAllName
            ) {
                String name = as.getName();
                objectsAll.add(name);

            }

        }


        //lab 收入 组合 性别
        if(jsonObject.getString("收入") != null  && jsonObject.getString("sex") != null){
            //寻找年龄
            String sex = jsonObject.getString("sex");
            String age = jsonObject.getString("收入");
            LabVo  labVo = sqyxBaseServer.finOneLable(age);
            String condiTions = labVo.getCondiTions();
            JSONObject jsonObject1 = JSON.parseObject(condiTions);
            String age1 = jsonObject1.getString("收入");
            System.out.println(age1);
            JSONObject jsonObject2 = JSON.parseObject(age1);
            String fhs = jsonObject2.getString("fh");
            String fh = "";
            if(fhs.equals("大于")){
                fh = ">";
            }
            if(fhs.equals("小于")){
                fh = "<";
            }
            Integer put = jsonObject2.getInteger("put");
            System.out.println(put);
            //找到所有的name 去重
            List<SqyxBase> finAllName = sqyxBaseServer.selectSruSex(fh,put,sex);
            for (SqyxBase as:finAllName
            ) {
                String name = as.getName();
                objectsAll.add(name);

            }

        }




        //lab 活动参与度
        if(jsonObject.getString("活动参与度") != null && jsonObject.getString("sex") == null && jsonObject.getString("age") == null){
            //寻找年龄
            String age = jsonObject.getString("活动参与度");
            LabVo  labVo = sqyxBaseServer.finOneLable(age);
            String condiTions = labVo.getCondiTions();
            JSONObject jsonObject1 = JSON.parseObject(condiTions);
            String age1 = jsonObject1.getString("活动参与度");
            System.out.println(age1);
            JSONObject jsonObject2 = JSON.parseObject(age1);
            String fhs = jsonObject2.getString("fh");
            String fh = "";
            if(fhs.equals("大于")){
                fh = ">";
            }
            if(fhs.equals("小于")){
                fh = "<";
            }
            Integer put = jsonObject2.getInteger("put");
            System.out.println(put);
            //找到所有的name 去重
            List<SqyxBase> finAllName = sqyxBaseServer.selectHy(fh,put);
            for (SqyxBase as:finAllName
            ) {
                String name = as.getName();
                objectsAll.add(name);

            }

        }

        //lab 活动参与度
        if(jsonObject.getString("活动参与度") != null && jsonObject.getString("sex") != null ){
            //寻找年龄
            String sex = jsonObject.getString("sex");
            String age = jsonObject.getString("活动参与度");
            LabVo  labVo = sqyxBaseServer.finOneLable(age);
            String condiTions = labVo.getCondiTions();
            JSONObject jsonObject1 = JSON.parseObject(condiTions);
            String age1 = jsonObject1.getString("活动参与度");
            System.out.println(age1);
            JSONObject jsonObject2 = JSON.parseObject(age1);
            String fhs = jsonObject2.getString("fh");
            String fh = "";
            if(fhs.equals("大于")){
                fh = ">";
            }
            if(fhs.equals("小于")){
                fh = "<";
            }
            Integer put = jsonObject2.getInteger("put");
            System.out.println(put);
            //找到所有的name 去重
            List<SqyxBase> finAllName = sqyxBaseServer.selectHysex(fh,put,sex);
            for (SqyxBase as:finAllName
            ) {
                String name = as.getName();
                objectsAll.add(name);

            }

        }

        //lab 点赞率
        if(jsonObject.getString("点赞率") != null && jsonObject.getString("sex") == null && jsonObject.getString("age") == null){
            //寻找年龄
            String age = jsonObject.getString("点赞率");
            LabVo  labVo = sqyxBaseServer.finOneLable(age);
            String condiTions = labVo.getCondiTions();
            JSONObject jsonObject1 = JSON.parseObject(condiTions);
            String age1 = jsonObject1.getString("点赞率");
            System.out.println(age1);
            JSONObject jsonObject2 = JSON.parseObject(age1);
            String fhs = jsonObject2.getString("fh");
            String fh = "";
            if(fhs.equals("大于")){
                fh = ">";
            }
            if(fhs.equals("小于")){
                fh = "<";
            }
            Integer put = jsonObject2.getInteger("put");
            System.out.println(put);
            //找到所有的name 去重
            List<SqyxBase> finAllName = sqyxBaseServer.selectDz(fh,put);
            for (SqyxBase as:finAllName
            ) {
                String name = as.getName();
                objectsAll.add(name);

            }

        }


        //lab 点赞率
        if(jsonObject.getString("点赞率") != null && jsonObject.getString("sex") != null){
            //寻找年龄
            String sex = jsonObject.getString("sex");
            String age = jsonObject.getString("点赞率");
            LabVo  labVo = sqyxBaseServer.finOneLable(age);
            String condiTions = labVo.getCondiTions();
            JSONObject jsonObject1 = JSON.parseObject(condiTions);
            String age1 = jsonObject1.getString("点赞率");
            System.out.println(age1);
            JSONObject jsonObject2 = JSON.parseObject(age1);
            String fhs = jsonObject2.getString("fh");
            String fh = "";
            if(fhs.equals("大于")){
                fh = ">";
            }
            if(fhs.equals("小于")){
                fh = "<";
            }
            Integer put = jsonObject2.getInteger("put");
            System.out.println(put);
            //找到所有的name 去重
            List<SqyxBase> finAllName = sqyxBaseServer.selectDzsex(fh,put,sex);
            for (SqyxBase as:finAllName
            ) {
                String name = as.getName();
                objectsAll.add(name);

            }

        }


        //lab 话题发起
        if(jsonObject.getString("话题发起") != null && jsonObject.getString("sex") == null){
            //寻找年龄
            String age = jsonObject.getString("话题发起");
            LabVo  labVo = sqyxBaseServer.finOneLable(age);
            String condiTions = labVo.getCondiTions();
            JSONObject jsonObject1 = JSON.parseObject(condiTions);
            String age1 = jsonObject1.getString("话题发起");
            System.out.println(age1);
            JSONObject jsonObject2 = JSON.parseObject(age1);
            String fhs = jsonObject2.getString("fh");
            String fh = "";
            if(fhs.equals("大于")){
                fh = ">";
            }
            if(fhs.equals("小于")){
                fh = "<";
            }
            Integer put = jsonObject2.getInteger("put");
            System.out.println(put);
            //找到所有的name 去重
            List<SqyxBase> finAllName = sqyxBaseServer.selectAge(fh,put);
            for (SqyxBase as:finAllName
            ) {
                String name = as.getName();
                objectsAll.add(name);

            }

        }

        //lab 话题发起
        if(jsonObject.getString("话题发起") != null && jsonObject.getString("sex") != null){
            //寻找年龄
            String sex = jsonObject.getString("sex");
            String age = jsonObject.getString("话题发起");
            LabVo  labVo = sqyxBaseServer.finOneLable(age);
            String condiTions = labVo.getCondiTions();
            JSONObject jsonObject1 = JSON.parseObject(condiTions);
            String age1 = jsonObject1.getString("话题发起");
            System.out.println(age1);
            JSONObject jsonObject2 = JSON.parseObject(age1);
            String fhs = jsonObject2.getString("fh");
            String fh = "";
            if(fhs.equals("大于")){
                fh = ">";
            }
            if(fhs.equals("小于")){
                fh = "<";
            }
            Integer put = jsonObject2.getInteger("put");
            System.out.println(put);
            //找到所有的name 去重
            List<SqyxBase> finAllName = sqyxBaseServer.selectAgeSex(fh,put,sex);
            for (SqyxBase as:finAllName
            ) {
                String name = as.getName();
                objectsAll.add(name);

            }

        }

        //lab 访问时间
        if(jsonObject.getString("访问时间") != null){
            //寻找年龄
            String age = jsonObject.getString("访问时间");
            LabVo  labVo = sqyxBaseServer.finOneLable(age);
            String condiTions = labVo.getCondiTions();
            JSONObject jsonObject1 = JSON.parseObject(condiTions);
            String age1 = jsonObject1.getString("访问时间");
            System.out.println(age1);
            JSONObject jsonObject2 = JSON.parseObject(age1);
            Date starttime = jsonObject2.getDate("starttime");
            Date endtime = jsonObject2.getDate("endtime");
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            String fwstarttimes = sdf.format(starttime);
            String fwendtimes = sdf.format(endtime);





            //找到所有的name 去重
            List<SqyxBase> finAllName = sqyxBaseServer.selectfwtime(fwstarttimes,fwendtimes);
            for (SqyxBase as:finAllName
            ) {
                String name = as.getName();
                objectsAll.add(name);

            }

        }

        //lab 访问时间
        if(jsonObject.getString("注册时间") != null){
            //寻找年龄
            String age = jsonObject.getString("注册时间");
            LabVo  labVo = sqyxBaseServer.finOneLable(age);
            String condiTions = labVo.getCondiTions();
            JSONObject jsonObject1 = JSON.parseObject(condiTions);
            String age1 = jsonObject1.getString("注册时间");
            System.out.println(age1);
            JSONObject jsonObject2 = JSON.parseObject(age1);
            Date starttime = jsonObject2.getDate("starttime");
            Date endtime = jsonObject2.getDate("endtime");
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            String fwstarttimes = sdf.format(starttime);
            String fwendtimes = sdf.format(endtime);

            //找到所有的name 去重
            List<SqyxBase> finAllName = sqyxBaseServer.selectfwtime2(fwstarttimes,fwendtimes);
            for (SqyxBase as:finAllName
            ) {
                String name = as.getName();
                objectsAll.add(name);

            }

        }



        //lab 客单价 组合 年龄
        if(jsonObject.getString("客单价") != null && jsonObject.getString("sex") == null && jsonObject.getString("age") == null){
            //寻找年龄
            String age = jsonObject.getString("客单价");
            LabVo  labVo = sqyxBaseServer.finOneLable(age);
            String condiTions = labVo.getCondiTions();
            JSONObject jsonObject1 = JSON.parseObject(condiTions);
            String age1 = jsonObject1.getString("客单价");
            System.out.println(age1);
            JSONObject jsonObject2 = JSON.parseObject(age1);
            String fhs = jsonObject2.getString("fh");
            String fh = "";
            if(fhs.equals("大于")){
                fh = ">";
            }
            if(fhs.equals("小于")){
                fh = "<";
            }
            Integer put = jsonObject2.getInteger("put");
            System.out.println(put);
            //找到所有的name 去重  productpriceone
            List<SqyxBase> finAllName = sqyxBaseServer.selectKdj(fh,put);
            for (SqyxBase as:finAllName
            ) {
                String name = as.getName();
                objectsAll.add(name);

            }

        }


        //lab 客单价
        if(jsonObject.getString("客单价") != null && jsonObject.getString("sex") != null){
            String sex = jsonObject.getString("sex");
            //寻找年龄
            String age = jsonObject.getString("客单价");
            LabVo  labVo = sqyxBaseServer.finOneLable(age);
            String condiTions = labVo.getCondiTions();
            JSONObject jsonObject1 = JSON.parseObject(condiTions);
            String age1 = jsonObject1.getString("客单价");
            System.out.println(age1);
            JSONObject jsonObject2 = JSON.parseObject(age1);
            String fhs = jsonObject2.getString("fh");
            String fh = "";
            if(fhs.equals("大于")){
                fh = ">";
            }
            if(fhs.equals("小于")){
                fh = "<";
            }
            Integer put = jsonObject2.getInteger("put");
            System.out.println(put);
            //找到所有的name 去重  productpriceone
            List<SqyxBase> finAllName = sqyxBaseServer.selectKdjsex(fh,put,sex);
            for (SqyxBase as:finAllName
            ) {
                String name = as.getName();
                objectsAll.add(name);

            }

        }




        //lab 消费活跃用户
        if(jsonObject.getString("消费活跃用户") != null && jsonObject.getString("sex") == null  && jsonObject.getString("age") == null){
            //寻找年龄
            String age = jsonObject.getString("消费活跃用户");
            LabVo  labVo = sqyxBaseServer.finOneLable(age);
            String condiTions = labVo.getCondiTions();
            JSONObject jsonObject1 = JSON.parseObject(condiTions);
            String age1 = jsonObject1.getString("消费活跃用户");
            System.out.println(age1);
            JSONObject jsonObject2 = JSON.parseObject(age1);
            String fhs = jsonObject2.getString("fh");
            String fh = "";
            if(fhs.equals("大于")){
                fh = ">";
            }
            if(fhs.equals("小于")){
                fh = "<";
            }
            Integer put = jsonObject2.getInteger("put");
            System.out.println(put);
            //找到所有的name 去重  productpriceone
            List<SqyxBase> finAllName = sqyxBaseServer.selectAge(fh,put);
            for (SqyxBase as:finAllName
            ) {
                String name = as.getName();
                objectsAll.add(name);

            }

        }

        //lab 消费活跃用户
        if(jsonObject.getString("消费活跃用户") != null && jsonObject.getString("sex") != null){
            //寻找年龄
            String sex = jsonObject.getString("sex");
            String age = jsonObject.getString("消费活跃用户");
            LabVo  labVo = sqyxBaseServer.finOneLable(age);
            String condiTions = labVo.getCondiTions();
            JSONObject jsonObject1 = JSON.parseObject(condiTions);
            String age1 = jsonObject1.getString("消费活跃用户");
            System.out.println(age1);
            JSONObject jsonObject2 = JSON.parseObject(age1);
            String fhs = jsonObject2.getString("fh");
            String fh = "";
            if(fhs.equals("大于")){
                fh = ">";
            }
            if(fhs.equals("小于")){
                fh = "<";
            }
            Integer put = jsonObject2.getInteger("put");
            System.out.println(put);
            //找到所有的name 去重  productpriceone
            List<SqyxBase> finAllName = sqyxBaseServer.selectAgeSex(fh,put,sex);
            for (SqyxBase as:finAllName
            ) {
                String name = as.getName();
                objectsAll.add(name);

            }

        }

        //lab 消费能力
        if(jsonObject.getString("consumption") != null && jsonObject.getString("sex") == null){
            //寻找年龄
            String age = jsonObject.getString("consumption");
            LabVo  labVo = sqyxBaseServer.finOneLable(age);
            String condiTions = labVo.getCondiTions();
            JSONObject jsonObject1 = JSON.parseObject(condiTions);
            String age1 = jsonObject1.getString("consumption");
            System.out.println(age1);
            JSONObject jsonObject2 = JSON.parseObject(age1);
            String fhs = jsonObject2.getString("fh");
            String fh = "";
            if(fhs.equals("大于")){
                fh = ">";
            }
            if(fhs.equals("小于")){
                fh = "<";
            }
            Integer put = jsonObject2.getInteger("put");
            System.out.println(put);
            //找到所有的name 去重  productpriceone
            List<SqyxBase> finAllName = sqyxBaseServer.selectSru(fh,put);
            for (SqyxBase as:finAllName
            ) {
                String name = as.getName();
                objectsAll.add(name);

            }

        }

        //lab 消费能力
        if(jsonObject.getString("consumption") != null && jsonObject.getString("sex") != null){
            //寻找年龄
            String sex = jsonObject.getString("sex");
            String age = jsonObject.getString("consumption");
            LabVo  labVo = sqyxBaseServer.finOneLable(age);
            String condiTions = labVo.getCondiTions();
            JSONObject jsonObject1 = JSON.parseObject(condiTions);
            String age1 = jsonObject1.getString("consumption");
            System.out.println(age1);
            JSONObject jsonObject2 = JSON.parseObject(age1);
            String fhs = jsonObject2.getString("fh");
            String fh = "";
            if(fhs.equals("大于")){
                fh = ">";
            }
            if(fhs.equals("小于")){
                fh = "<";
            }
            Integer put = jsonObject2.getInteger("put");
            System.out.println(put);
            //找到所有的name 去重  productpriceone
            List<SqyxBase> finAllName = sqyxBaseServer.selectSruSex(fh,put,sex);
            for (SqyxBase as:finAllName
            ) {
                String name = as.getName();
                objectsAll.add(name);

            }

        }

        // sex
        if(jsonObject.getString("sex") != null && jsonObject.getString("age") == null && jsonObject.getString("收入") == null
        && jsonObject.getString("客单价") == null && jsonObject.getString("消费活跃用户") == null
        && jsonObject.getString("consumption") == null && jsonObject.getString("点赞率") == null
        && jsonObject.getString("活动参与度") == null
        && jsonObject.getString("话题发起") == null){
            //寻找年龄
            String sex = jsonObject.getString("sex");

            List<SqyxBase> finAllName = sqyxBaseServer.selectSex(sex);
            for (SqyxBase as:finAllName
            ) {
                String name = as.getName();
                objectsAll.add(name);

            }

        }

        // 城市
        if(jsonObject.getString("城市") != null){
            //寻找年龄
            String city = jsonObject.getString("城市");



            List<SqyxBase> finAllName = sqyxBaseServer.selectArea(city);
            for (SqyxBase as:finAllName
            ) {
                String name = as.getName();
                objectsAll.add(name);

            }

        }

        // 职业
        if(jsonObject.getString("职业") != null){
            //寻找年龄
            String profession = jsonObject.getString("职业");



            List<SqyxBase> finAllName = sqyxBaseServer.selectprofession(profession);
            for (SqyxBase as:finAllName
            ) {
                String name = as.getName();
                objectsAll.add(name);

            }

        }

        // 星座
        if(jsonObject.getString("星座") != null){
            //寻找年龄
            String constellation = jsonObject.getString("星座");



            List<SqyxBase> finAllName = sqyxBaseServer.selectconstellation(constellation);
            for (SqyxBase as:finAllName
            ) {
                String name = as.getName();
                objectsAll.add(name);

            }

        }

        // 会员
        if(jsonObject.getString("membergrade") != null){
            //寻找年龄
            String membergrade = jsonObject.getString("membergrade");



            List<SqyxBase> finAllName = sqyxBaseServer.selectmembergrade(membergrade);
            for (SqyxBase as:finAllName
            ) {
                String name = as.getName();
                objectsAll.add(name);

            }

        }

        // 消费偏好
        if(jsonObject.getString("preference") != null){
            //寻找年龄
            String preference = jsonObject.getString("preference");



            List<SqyxBase> finAllName = sqyxBaseServer.selectpreference(preference);
            for (SqyxBase as:finAllName
            ) {
                String name = as.getName();
                objectsAll.add(name);

            }

        }

        // 需求偏好
        if(jsonObject.getString("需求偏好") != null){
            //寻找年龄
            String preference = jsonObject.getString("需求偏好");



            List<SqyxBase> finAllName = sqyxBaseServer.selectpreference2(preference);
            for (SqyxBase as:finAllName
            ) {
                String name = as.getName();
                objectsAll.add(name);

            }

        }

        // 行为 新增
        if(jsonObject.getJSONObject("newlyadded") != null){
            //寻找年龄
            JSONObject news = jsonObject.getJSONObject("newlyadded");

            Date starttime = news.getDate("starttime");
            Date endtime = news.getDate("endtime");
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            String newsstarttimes = sdf.format(starttime);
            String newsendtimes = sdf.format(endtime);

            List<SqyxBase> finAllName = sqyxBaseServer.selectnewxz(newsstarttimes,newsendtimes);
            for (SqyxBase as:finAllName
            ) {
                String name = as.getName();
                objectsAll.add(name);

            }

        }

        // 行为 签到
        if(jsonObject.getJSONObject("signin") != null){
            //寻找年龄
            JSONObject news = jsonObject.getJSONObject("signin");

            Date starttime = news.getDate("starttime");
            Date endtime = news.getDate("endtime");
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            String newsstarttimes = sdf.format(starttime);
            String newsendtimes = sdf.format(endtime);

            List<SqyxBase> finAllName = sqyxBaseServer.selectqd(newsstarttimes,newsendtimes);
            for (SqyxBase as:finAllName
            ) {
                String name = as.getName();
                objectsAll.add(name);

            }

        }

        // 行为 发言
        if(jsonObject.getJSONObject("speak") != null){
            //寻找年龄
            JSONObject news = jsonObject.getJSONObject("speak");

            Date starttime = news.getDate("starttime");
            Date endtime = news.getDate("endtime");
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            String newsstarttimes = sdf.format(starttime);
            String newsendtimes = sdf.format(endtime);

            List<SqyxBase> finAllName = sqyxBaseServer.selectqd(newsstarttimes,newsendtimes);
            for (SqyxBase as:finAllName
            ) {
                String name = as.getName();
                objectsAll.add(name);

            }

        }

        // 行为 话题发起
        if(jsonObject.getJSONObject("topicinitiation") != null){
            //寻找年龄
            JSONObject news = jsonObject.getJSONObject("topicinitiation");

            Date starttime = news.getDate("starttime");
            Date endtime = news.getDate("endtime");
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            String newsstarttimes = sdf.format(starttime);
            String newsendtimes = sdf.format(endtime);

            List<SqyxBase> finAllName = sqyxBaseServer.selectqd(newsstarttimes,newsendtimes);
            for (SqyxBase as:finAllName
            ) {
                String name = as.getName();
                objectsAll.add(name);

            }

        }

        // 行为 发起
        if(jsonObject.getJSONObject("share") != null){
            //寻找年龄
            JSONObject news = jsonObject.getJSONObject("share");

            Date starttime = news.getDate("starttime");
            Date endtime = news.getDate("endtime");
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            String newsstarttimes = sdf.format(starttime);
            String newsendtimes = sdf.format(endtime);

            List<SqyxBase> finAllName = sqyxBaseServer.selectqd(newsstarttimes,newsendtimes);
            for (SqyxBase as:finAllName
            ) {
                String name = as.getName();
                objectsAll.add(name);

            }

        }
        //找到总人数
        int countpeo = sqyxBaseServer.gitAllPeoper();




        HashSet<String> lastName = new HashSet<>(objectsAll);

        ArrayList<String> lastttttname = new ArrayList<>(lastName);


        if(lastttttname.size() != 0) {

            //找到当前的所有name 然后去重
            LocalDistributionVo localDistribution = sqyxBaseServer.findlocal(lastttttname);

            Map sh = new HashMap<>();
            sh.put("name", "上海市");
            sh.put("value", localDistribution.getSh());

            Map zj = new HashMap<>();
            zj.put("name", "浙江省");
            zj.put("value", localDistribution.getZj());

            Map hb = new HashMap<>();
            hb.put("name", "湖北省");
            hb.put("value", localDistribution.getHb());

            Map jx = new HashMap<>();
            jx.put("name", "江西省");
            jx.put("value", localDistribution.getJx());

            Map fj = new HashMap<>();
            fj.put("name", "福建省");
            fj.put("value", localDistribution.getFj());

            Map ah = new HashMap<>();
            ah.put("name", "安徽省");
            ah.put("value", localDistribution.getAh());

            Map yn = new HashMap<>();
            yn.put("name", "云南省");
            yn.put("value", localDistribution.getYn());

            Map hn = new HashMap<>();
            hn.put("name", "海南省");
            hn.put("value", localDistribution.getHn());

            Map hlj = new HashMap<>();
            hlj.put("name", "黑龙江省");
            hlj.put("value", localDistribution.getHlj());

            Map tj = new HashMap<>();
            tj.put("name", "天津市");
            tj.put("value", localDistribution.getTj());

            Map sc = new HashMap<>();
            sc.put("name", "四川省");
            sc.put("value", localDistribution.getSc());

            Map qh = new HashMap<>();
            qh.put("name", "青海省");
            qh.put("value", localDistribution.getQh());

            Map jl = new HashMap<>();
            jl.put("name", "吉林省");
            jl.put("value", localDistribution.getJl());

            Map tw = new HashMap<>();
            tw.put("name", "台湾省");
            tw.put("value", localDistribution.getTw());

            Map hx = new HashMap<>();
            hx.put("name", "陕西省");
            hx.put("value", localDistribution.getHx());

            Map gx = new HashMap<>();
            gx.put("name", "甘肃省");
            gx.put("value", localDistribution.getGx());


            Map sx = new HashMap<>();
            sx.put("name", "山西省");
            sx.put("value", localDistribution.getSx());

            Map gd = new HashMap<>();
            gd.put("name", "广东省");
            gd.put("value", localDistribution.getGd());

            Map bj = new HashMap<>();
            bj.put("name", "北京市");
            bj.put("value", localDistribution.getBj());

            Map hbs = new HashMap<>();
            hbs.put("name", "河北省");
            hbs.put("value", localDistribution.getHbs());

            Map hns = new HashMap<>();
            hns.put("name", "河南省");
            hns.put("value", localDistribution.getHns());

            Map cx = new HashMap<>();
            cx.put("name", "重庆市");
            cx.put("value", localDistribution.getCx());

            Map hnss = new HashMap<>();
            hnss.put("name", "湖南省");
            hnss.put("value", localDistribution.getHnss());

            ArrayList<Map> dq = new ArrayList<>();
            dq.add(sh);
            dq.add(zj);
            dq.add(hb);
            dq.add(jx);
            dq.add(fj);
            dq.add(ah);
            dq.add(yn);
            dq.add(hn);
            dq.add(hlj);
            dq.add(tj);
            dq.add(sc);
            dq.add(qh);
            dq.add(jl);
            dq.add(tw);
            dq.add(hx);
            dq.add(gx);
            dq.add(sx);
            dq.add(gd);
            dq.add(bj);
            dq.add(hbs);
            dq.add(hns);
            dq.add(cx);
            dq.add(hnss);

            //找到年龄分布10-20-30-40-50-100ageDistribution
            //AgedistributionVo agedistributionVo = captchaControllerServer.getageDistribution(listWithoutDuplicates);

            AgedistributionVo agedistributionVo = sqyxBaseServer.getageDistribution(lastttttname);


            Map mapageV = new HashMap<>();
            mapageV.put("name", "0-20");
            mapageV.put("value", agedistributionVo.getV());

            Map mapageVI = new HashMap<>();
            mapageVI.put("name", "20-30");
            mapageVI.put("value", agedistributionVo.getVi());

            Map mapageVII = new HashMap<>();
            mapageVII.put("name", "30-40");
            mapageVII.put("value", agedistributionVo.getVii());

            Map mapageVIII = new HashMap<>();
            mapageVIII.put("name", ">40");
            mapageVIII.put("value", agedistributionVo.getViii());

            ArrayList<Map> agecount = new ArrayList<>();
            agecount.add(mapageV);
            agecount.add(mapageVI);
            agecount.add(mapageVII);
            agecount.add(mapageVIII);


            //根据name 找到 男生 女生 的数量
            SexCount gitsex = sqyxBaseServer.gitsex(lastttttname);

            Map mapageS = new HashMap<>();
            mapageS.put("name", "男");
            mapageS.put("value", gitsex.getMan());

            Map mapageSI = new HashMap<>();
            mapageSI.put("name", "女");
            mapageSI.put("value", gitsex.getWoman());

            ArrayList<Map> sexcount = new ArrayList<>();
            sexcount.add(mapageS);
            sexcount.add(mapageSI);

            //收入分布 incomeDistribution
            //ConsumptVo getincomeDistribution = captchaControllerServer.getsr(objects);

            ConsumptVo getsr = sqyxBaseServer.getsr(lastttttname);

            Map comP = new HashMap<>();
            comP.put("name", "0-3000");
            comP.put("value", getsr.getR());

            Map comPI = new HashMap<>();
            comPI.put("name", "3000-6000");
            comPI.put("value", getsr.getRi());

            Map comPII = new HashMap<>();
            comPII.put("name", "6000-9000");
            comPII.put("value", getsr.getRii());

            Map comPIII = new HashMap<>();
            comPIII.put("name", ">9000");
            comPIII.put("value", getsr.getRiii());
            ArrayList<Map> sonvos = new ArrayList<>();
            sonvos.add(comP);
            sonvos.add(comPI);
            sonvos.add(comPII);
            sonvos.add(comPIII);


            DisplayuserportraitVo displayuserportraitVo = new DisplayuserportraitVo();
            //人名去重复的值
            displayuserportraitVo.setNewpeo(lastttttname.size());

            displayuserportraitVo.setCountpeo(countpeo);
            displayuserportraitVo.setLocalDistribution(dq);
            displayuserportraitVo.setLabelname(labelname);
            displayuserportraitVo.setAgedistribution(agecount);
            displayuserportraitVo.setSexdistribution(sexcount);
            displayuserportraitVo.setIncomeAnalysis(sonvos);
            displayuserportraitVo.setConsumptionAmountDistribution(sonvos);

            return ResultBean.success(displayuserportraitVo);

        }else {

            //找到当前的所有name 然后去重


            Map sh = new HashMap<>();
            sh.put("name", "上海市");
            sh.put("value", 0);

            Map zj = new HashMap<>();
            zj.put("name", "浙江省");
            zj.put("value", 0);

            Map hb = new HashMap<>();
            hb.put("name", "湖北省");
            hb.put("value", 0);

            Map jx = new HashMap<>();
            jx.put("name", "江西省");
            jx.put("value", 0);

            Map fj = new HashMap<>();
            fj.put("name", "福建省");
            fj.put("value", 0);

            Map ah = new HashMap<>();
            ah.put("name", "安徽省");
            ah.put("value", 0);

            Map yn = new HashMap<>();
            yn.put("name", "云南省");
            yn.put("value", 0);

            Map hn = new HashMap<>();
            hn.put("name", "海南省");
            hn.put("value", 0);

            Map hlj = new HashMap<>();
            hlj.put("name", "黑龙江省");
            hlj.put("value",0);

            Map tj = new HashMap<>();
            tj.put("name", "天津市");
            tj.put("value", 0);

            Map sc = new HashMap<>();
            sc.put("name", "四川省");
            sc.put("value", 0);

            Map qh = new HashMap<>();
            qh.put("name", "青海省");
            qh.put("value", 0);

            Map jl = new HashMap<>();
            jl.put("name", "吉林省");
            jl.put("value", 0);

            Map tw = new HashMap<>();
            tw.put("name", "台湾省");
            tw.put("value", 0);

            Map hx = new HashMap<>();
            hx.put("name", "陕西省");
            hx.put("value", 0);

            Map gx = new HashMap<>();
            gx.put("name", "甘肃省");
            gx.put("value", 0);


            Map sx = new HashMap<>();
            sx.put("name", "山西省");
            sx.put("value", 0);

            Map gd = new HashMap<>();
            gd.put("name", "广东省");
            gd.put("value", 0);

            Map bj = new HashMap<>();
            bj.put("name", "北京市");
            bj.put("value", 0);

            Map hbs = new HashMap<>();
            hbs.put("name", "河北省");
            hbs.put("value", 0);

            Map hns = new HashMap<>();
            hns.put("name", "河南省");
            hns.put("value", 0);

            Map cx = new HashMap<>();
            cx.put("name", "重庆市");
            cx.put("value", 0);

            Map hnss = new HashMap<>();
            hnss.put("name", "湖南省");
            hnss.put("value", 0);

            ArrayList<Map> dq = new ArrayList<>();
            dq.add(sh);
            dq.add(zj);
            dq.add(hb);
            dq.add(jx);
            dq.add(fj);
            dq.add(ah);
            dq.add(yn);
            dq.add(hn);
            dq.add(hlj);
            dq.add(tj);
            dq.add(sc);
            dq.add(qh);
            dq.add(jl);
            dq.add(tw);
            dq.add(hx);
            dq.add(gx);
            dq.add(sx);
            dq.add(gd);
            dq.add(bj);
            dq.add(hbs);
            dq.add(hns);
            dq.add(cx);
            dq.add(hnss);


            //找到年龄分布10-20-30-40-50-100ageDistribution
            //AgedistributionVo agedistributionVo = captchaControllerServer.getageDistribution(listWithoutDuplicates);



            Map mapageV = new HashMap<>();
            mapageV.put("name", "0-20");
            mapageV.put("value",0);

            Map mapageVI = new HashMap<>();
            mapageVI.put("name", "20-30");
            mapageVI.put("value", 0);

            Map mapageVII = new HashMap<>();
            mapageVII.put("name", "30-40");
            mapageVII.put("value",0);

            Map mapageVIII = new HashMap<>();
            mapageVIII.put("name", ">40");
            mapageVIII.put("value",0);

            ArrayList<Map> agecount = new ArrayList<>();
            agecount.add(mapageV);
            agecount.add(mapageVI);
            agecount.add(mapageVII);
            agecount.add(mapageVIII);


            //根据name 找到 男生 女生 的数量


            Map mapageS = new HashMap<>();
            mapageS.put("name", "男");
            mapageS.put("value", 0);

            Map mapageSI = new HashMap<>();
            mapageSI.put("name", "女");
            mapageSI.put("value", 0);

            ArrayList<Map> sexcount = new ArrayList<>();
            sexcount.add(mapageS);
            sexcount.add(mapageSI);

            //收入分布 incomeDistribution
            //ConsumptVo getincomeDistribution = captchaControllerServer.getsr(objects);



            Map comP = new HashMap<>();
            comP.put("name", "0-3000");
            comP.put("value", 0);

            Map comPI = new HashMap<>();
            comPI.put("name", "3000-6000");
            comPI.put("value", 0);

            Map comPII = new HashMap<>();
            comPII.put("name", "6000-9000");
            comPII.put("value", 0);

            Map comPIII = new HashMap<>();
            comPIII.put("name", ">9000");
            comPIII.put("value", 0);
            ArrayList<Map> sonvos = new ArrayList<>();
            sonvos.add(comP);
            sonvos.add(comPI);
            sonvos.add(comPII);
            sonvos.add(comPIII);

           // Set<String> middleHashSet = new HashSet<String>(objects);

           // List<String> afterHashSetList = new ArrayList<String>(middleHashSet);

            //拿到所有标签名称userid
/*        List<SqyxLabel> labname=sqyxLabelServer.finmyself(userid);
        for (SqyxLabel aa:labname
             ) {

            System.out.println( aa.getLabelname() );
        }*/


            DisplayuserportraitVo displayuserportraitVo = new DisplayuserportraitVo();
            displayuserportraitVo.setNewpeo(lastttttname.size());
            displayuserportraitVo.setCountpeo(countpeo);
            displayuserportraitVo.setLocalDistribution(dq);
            displayuserportraitVo.setLabelname(labelname);
            displayuserportraitVo.setAgedistribution(agecount);
            displayuserportraitVo.setSexdistribution(sexcount);
            displayuserportraitVo.setIncomeAnalysis(sonvos);
            displayuserportraitVo.setConsumptionAmountDistribution(sonvos);

            /*        displayuserportraitVo.setSqyxLabels(labname);*/
            return ResultBean.success(displayuserportraitVo);
        }





    }


        /*
     *
     *功能描述  根据所有条件 查询到分析图例 并且返回
     * @author lzb
     * @date 2022/2/22 creategroupportrait
     * @param
     * @return
     */

    @RequestMapping("creategroupportrait2")
    @ResponseBody
    public ResultBean creategroupportrait2(@RequestBody String data,HttpServletRequest request) {

        String token = request.getHeader("Authorization");
        String jwt = token.substring(token.lastIndexOf(" ") + 1);
        User u = JwtUtil.unsign(jwt, User.class);
        if (u == null) {
            return ResultBean.error("token无效");
        }

        int userid = u.getId();

        //找到总人数
        int countpeo = sqyxBaseServer.gitAllPeoper();

        JSONObject jsonObject = JSON.parseObject(data);
        //拿到所有条件
        //查询到人数后 存入标签库
        //默认对xxx进行统计
        //找到所有的name 然后去重
        //拿到条件
        String sex = jsonObject.getString("sex");
        String labelname = jsonObject.getString("labelname");


/*        JSONObject age = null;
        age = jsonObject.getJSONObject("age");
        String fh = null;
        Integer put = null;
        int countage = 0;

        if (age != null) {
            //拿到put
            fh = age.getString("fh");
            put = age.getInteger("put");
            System.out.println(fh);
            System.out.println(put);
            int dyage = 0;
            int xyage = 0;

            if (fh.equals("大于")) {
                dyage = sqyxBaseServer.dyage(put);
            }
            if (fh.equals("小于")) {
                xyage = sqyxBaseServer.xyage(put);
            }
            countage = dyage + xyage ;
            System.out.println(countage);
        } else {
            age = null;
            fh = null;
            put = null;
        }*/


        String membergrade = jsonObject.getString("membergrade");

        String cp = jsonObject.getString("preference");

        //拿到 消费能力
        String sp = null;
        sp = jsonObject.getString("consumption");

        Integer startsp = null;
        Integer endsp = null;
        String s21 = null;
        String ss22  = null;


        String profession = null;
        profession = jsonObject.getString("职业");
        String area = null;
        area = jsonObject.getString("城市");
        String constellation = null;
        constellation = jsonObject.getString("星座");
        String topicshare01 = null;

        topicshare01 = jsonObject.getString("活动参与度");

        String topiclike = null;

        topiclike = jsonObject.getString("点赞率");
        Integer dzmax = null;
        Integer dzsmall = null;
        if (topiclike != null) {
            if (topiclike.equals("高")) {
                dzmax = 10;
                dzsmall = 3;

            }

            if (topiclike.equals("低")) {
                dzmax = 2;
                dzsmall = 0;

            }
        } else {
            dzmax = null;
            dzsmall = null;
            topiclike = null;
        }

        Integer max = null;
        Integer small = null;
        if (topicshare01 != null) {
            if (topicshare01.equals("高")) {
                max = 10;
                small = 5;

            }

            if (topicshare01.equals("中")) {
                max = 4;
                small = 3;

            }

            if (topicshare01.equals("低")) {
                max = 2;
                small = 0;
            }
        } else {
            max = null;
            small = null;
            topicshare01 = null;
        }
        String topicshare02 = null;

        topicshare02 = jsonObject.getString("话题发起");
        Integer htmax = null;
        Integer htsmall = null;
        if (topicshare02 != null) {
            if (topicshare02.equals("高")) {
                htmax = 10;
                htsmall = 3;

            }

            if (topicshare02.equals("低")) {
                htmax = 2;
                htsmall = 0;

            }

        } else {
            topicshare02 = null;
            htmax = null;
            htsmall = null;
        }
        String fwstarttimes = null;
        String fwendtimes = null;

        String fwtime = null;
        fwtime = jsonObject.getString("访问时间");
        System.out.println(fwtime);
        if (fwtime != null) {
            String findlast = sqyxBaseServer.findlast(fwtime);
            System.out.println(findlast);
            JSONObject jsonObjectssss = JSON.parseObject(findlast);
            JSONObject jsonObject1 = jsonObjectssss.getJSONObject("访问时间");
            Date starttime = jsonObject1.getDate("starttime");
            Date endtime = jsonObject1.getDate("endtime");
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            fwstarttimes = sdf.format(starttime);
            fwendtimes = sdf.format(endtime);


        } else {
            fwstarttimes = null;
            fwendtimes = null;
            fwtime = null;

        }

        String zcstarttimes = null;
        String zcendtimes = null;

        String zctime = null;
        zctime = jsonObject.getString("注册时间");
        if (zctime != null) {
            //找到 标签名称
            String findlast = sqyxBaseServer.findlast(zctime);
            JSONObject jsonObjectsss = JSON.parseObject(findlast);
            JSONObject jsonObject1 = jsonObjectsss.getJSONObject("注册时间");
            //
            Date starttime = jsonObject1.getDate("starttime");
            Date endtime = jsonObject1.getDate("endtime");
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            zcstarttimes = sdf.format(starttime);
            zcendtimes = sdf.format(endtime);


        } else {
            zcstarttimes = null;
            zcendtimes = null;
            zctime = null;

        }

        String kdj = null;

        kdj = jsonObject.getString("客单价");
        Integer kdjmax = null;
        Integer kdjsmall = null;
        if (kdj != null) {
            if (kdj.equals("高")) {
                kdjmax = 99999;
                kdjsmall = 500;

            }

            if (kdj.equals("低")) {
                kdjmax = 499;
                kdjsmall = 0;

            }
        } else {
            kdjmax = null;
            kdjsmall = null;
            kdj = null;
        }
        String hyuser = null;

        hyuser = jsonObject.getString("消费活跃用户");
        Integer hymax = null;
        Integer hysmall = null;
        if (hyuser != null) {
            if (hyuser.equals("高")) {
                hymax = 20;
                hysmall = 4;

            }

            if (hyuser.equals("低")) {
                hymax = 3;
                hysmall = 0;

            }
        } else {
            hymax = null;
            hysmall = null;
            hyuser = null;
        }
        String xq = null;
        xq = jsonObject.getString("需求偏好");

        //拿到 消费能力
        JSONObject sr = null;
/*        sr = jsonObject.getJSONObject("收入");*/
        String srfh = null;
        Integer srput = null;
        int srcount = 0;

        if (sr != null) {
            //拿到put
            srfh = sr.getString("fh");
            srput = sr.getInteger("put");
            System.out.println(srfh);
            System.out.println(srput);
            int srcountfh = 0;
            int srcountput = 0;

            if (srfh.equals("大于")) {
                srcountfh = sqyxBaseServer.dysr(srput);
            }
            if (srfh.equals("小于")) {
                srcountput = sqyxBaseServer.xysr(srput);
            }
            srcount = srcountfh + srcountput ;
            System.out.println(srcount);
        } else {
            sr = null;
            srfh = null;
            srput = null;
        }

        //第1个属性 新增
        JSONObject news = null;
        String newsstarttimes = null;
        String newsendtimes = null;
        news = jsonObject.getJSONObject("newlyadded");
        if (news != null) {
            Date starttime = news.getDate("starttime");
            Date endtime = news.getDate("endtime");
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            newsstarttimes = sdf.format(starttime);
            newsendtimes = sdf.format(endtime);


        } else {
            newsstarttimes = null;
            newsendtimes = null;


        }

        //第2个属性 发言
        JSONObject speak = null;
        speak = jsonObject.getJSONObject("speak");
        String speakstarttimes = null;
        String speakendtimes = null;
        if (speak != null) {
            Date starttime = speak.getDate("starttime");
            Date endtime = speak.getDate("endtime");
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            speakstarttimes = sdf.format(starttime);
            speakendtimes = sdf.format(endtime);


        } else {
            speakstarttimes = null;
            speakendtimes = null;
        }

        //第3个属性 签到
        JSONObject signin = null;
        signin = jsonObject.getJSONObject("signin");
        String signinstarttimes = null;
        String signinendtimes = null;
        if (signin != null) {
            Date starttime = signin.getDate("starttime");
            Date endtime = signin.getDate("endtime");
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            signinstarttimes = sdf.format(starttime);
            signinendtimes = sdf.format(endtime);
            //int findCountnew = sqyxBaseServer.findCountnew(starttimes, endtimes);

        } else {
            signinstarttimes = null;
            signinendtimes = null;

        }
        //第4个属性 话题发起
        JSONObject ci = null;
        ci = jsonObject.getJSONObject("topicinitiation");
        String cistarttimes = null;
        String ciendtimes = null;
        if (ci != null) {
            Date starttime = ci.getDate("starttime");
            Date endtime = ci.getDate("endtime");
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            cistarttimes = sdf.format(starttime);
            ciendtimes = sdf.format(endtime);
            //int findCountnew = sqyxBaseServer.findCountnew(starttimes, endtimes);

        } else {
            cistarttimes = null;
            ciendtimes = null;
            //countci = 0;

        }

        //第5个属性 分享
        JSONObject share = null;
        share = jsonObject.getJSONObject("share");
        int countshare = 0;
        String sharestarttimes = null;
        String shareendtimes = null;
        if (share != null) {
            Date starttime = share.getDate("starttime");
            Date endtime = share.getDate("endtime");
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            sharestarttimes = sdf.format(starttime);
            shareendtimes = sdf.format(endtime);
            //int findCountnew = sqyxBaseServer.findCountnew(starttimes, endtimes);
            //countshare = findCountnew;

        } else {
            sharestarttimes = null;
            shareendtimes = null;
            //countshare = 0;
        }



        //先统计出 属性的 人数
        int countab = sqyxBaseServer.findCountab(sex, membergrade, cp, startsp, endsp
                , profession,
                area, constellation, max, small,
                dzmax, dzsmall, htmax, htsmall, fwstarttimes, fwendtimes,
                zcstarttimes, zcendtimes, kdjmax, kdjsmall,
                hymax, hysmall, xq, newsstarttimes, newsendtimes, speakstarttimes, speakendtimes, signinstarttimes, signinendtimes, cistarttimes, ciendtimes, sharestarttimes, shareendtimes);

        //造一个 name 集合总类
        List<String> objects = new ArrayList<>();
        //拿到所有的name
        List<String> allname = sqyxBaseServer.findAllByName(sex, membergrade, cp, startsp, endsp
                , profession,
                area, constellation, max, small,
                dzmax, dzsmall, htmax, htsmall, fwstarttimes, fwendtimes,
                zcstarttimes, zcendtimes, kdjmax, kdjsmall,
                hymax, hysmall, xq , newsstarttimes, newsendtimes, speakstarttimes, speakendtimes, signinstarttimes, signinendtimes, cistarttimes, ciendtimes, sharestarttimes, shareendtimes);
        for (String s : allname
        ) {
            System.out.println(s);
            objects.add(s);
        }
        System.out.println(allname);

        //地区分布 localDistribution
        //LocalDistributionVo localDistribution = captchaControllerServer.localDistribution(objects);


        //计算出全部值
//        int num = countab + countnew + countspeak + countsignin + countci + countshare;
        int num = countab;


        if(allname.size() != 0) {

            //找到当前的所有name 然后去重
            LocalDistributionVo localDistribution = sqyxBaseServer.findlocal(objects);

            Map sh = new HashMap<>();
            sh.put("name", "上海市");
            sh.put("value", localDistribution.getSh());

            Map zj = new HashMap<>();
            zj.put("name", "浙江省");
            zj.put("value", localDistribution.getZj());

            Map hb = new HashMap<>();
            hb.put("name", "湖北省");
            hb.put("value", localDistribution.getHb());

            Map jx = new HashMap<>();
            jx.put("name", "江西省");
            jx.put("value", localDistribution.getJx());

            Map fj = new HashMap<>();
            fj.put("name", "福建省");
            fj.put("value", localDistribution.getFj());

            Map ah = new HashMap<>();
            ah.put("name", "安徽省");
            ah.put("value", localDistribution.getAh());

            Map yn = new HashMap<>();
            yn.put("name", "云南省");
            yn.put("value", localDistribution.getYn());

            Map hn = new HashMap<>();
            hn.put("name", "海南省");
            hn.put("value", localDistribution.getHn());

            Map hlj = new HashMap<>();
            hlj.put("name", "黑龙江省");
            hlj.put("value", localDistribution.getHlj());

            Map tj = new HashMap<>();
            tj.put("name", "天津市");
            tj.put("value", localDistribution.getTj());

            Map sc = new HashMap<>();
            sc.put("name", "四川省");
            sc.put("value", localDistribution.getSc());

            Map qh = new HashMap<>();
            qh.put("name", "青海省");
            qh.put("value", localDistribution.getQh());

            Map jl = new HashMap<>();
            jl.put("name", "吉林省");
            jl.put("value", localDistribution.getJl());

            Map tw = new HashMap<>();
            tw.put("name", "台湾省");
            tw.put("value", localDistribution.getTw());

            Map hx = new HashMap<>();
            hx.put("name", "陕西省");
            hx.put("value", localDistribution.getHx());

            Map gx = new HashMap<>();
            gx.put("name", "甘肃省");
            gx.put("value", localDistribution.getGx());


            Map sx = new HashMap<>();
            sx.put("name", "山西省");
            sx.put("value", localDistribution.getSx());

            Map gd = new HashMap<>();
            gd.put("name", "广东省");
            gd.put("value", localDistribution.getGd());

            Map bj = new HashMap<>();
            bj.put("name", "北京市");
            bj.put("value", localDistribution.getBj());

            Map hbs = new HashMap<>();
            hbs.put("name", "河北省");
            hbs.put("value", localDistribution.getHbs());

            Map hns = new HashMap<>();
            hns.put("name", "河南省");
            hns.put("value", localDistribution.getHns());

            Map cx = new HashMap<>();
            cx.put("name", "重庆市");
            cx.put("value", localDistribution.getCx());

            Map hnss = new HashMap<>();
            hnss.put("name", "湖南省");
            hnss.put("value", localDistribution.getHnss());

            ArrayList<Map> dq = new ArrayList<>();
            dq.add(sh);
            dq.add(zj);
            dq.add(hb);
            dq.add(jx);
            dq.add(fj);
            dq.add(ah);
            dq.add(yn);
            dq.add(hn);
            dq.add(hlj);
            dq.add(tj);
            dq.add(sc);
            dq.add(qh);
            dq.add(jl);
            dq.add(tw);
            dq.add(hx);
            dq.add(gx);
            dq.add(sx);
            dq.add(gd);
            dq.add(bj);
            dq.add(hbs);
            dq.add(hns);
            dq.add(cx);
            dq.add(hnss);


            //找到年龄分布10-20-30-40-50-100ageDistribution
            //AgedistributionVo agedistributionVo = captchaControllerServer.getageDistribution(listWithoutDuplicates);

            AgedistributionVo agedistributionVo = sqyxBaseServer.getageDistribution(objects);


            Map mapageV = new HashMap<>();
            mapageV.put("name", "0-20");
            mapageV.put("value", agedistributionVo.getV());

            Map mapageVI = new HashMap<>();
            mapageVI.put("name", "20-30");
            mapageVI.put("value", agedistributionVo.getVi());

            Map mapageVII = new HashMap<>();
            mapageVII.put("name", "30-40");
            mapageVII.put("value", agedistributionVo.getVii());

            Map mapageVIII = new HashMap<>();
            mapageVIII.put("name", ">40");
            mapageVIII.put("value", agedistributionVo.getViii());

            ArrayList<Map> agecount = new ArrayList<>();
            agecount.add(mapageV);
            agecount.add(mapageVI);
            agecount.add(mapageVII);
            agecount.add(mapageVIII);


            //根据name 找到 男生 女生 的数量
            SexCount gitsex = sqyxBaseServer.gitsex(objects);

            Map mapageS = new HashMap<>();
            mapageS.put("name", "男");
            mapageS.put("value", gitsex.getMan());

            Map mapageSI = new HashMap<>();
            mapageSI.put("name", "女");
            mapageSI.put("value", gitsex.getWoman());

            ArrayList<Map> sexcount = new ArrayList<>();
            sexcount.add(mapageS);
            sexcount.add(mapageSI);

            //收入分布 incomeDistribution
            //ConsumptVo getincomeDistribution = captchaControllerServer.getsr(objects);

            ConsumptVo getsr = sqyxBaseServer.getsr(objects);

            Map comP = new HashMap<>();
            comP.put("name", "0-3000");
            comP.put("value", getsr.getR());

            Map comPI = new HashMap<>();
            comPI.put("name", "3000-6000");
            comPI.put("value", getsr.getRi());

            Map comPII = new HashMap<>();
            comPII.put("name", "6000-9000");
            comPII.put("value", getsr.getRii());

            Map comPIII = new HashMap<>();
            comPIII.put("name", ">9000");
            comPIII.put("value", getsr.getRiii());
            ArrayList<Map> sonvos = new ArrayList<>();
            sonvos.add(comP);
            sonvos.add(comPI);
            sonvos.add(comPII);
            sonvos.add(comPIII);

            Set<String> middleHashSet = new HashSet<String>(objects);

            List<String> afterHashSetList = new ArrayList<String>(middleHashSet);

            //拿到所有标签名称userid
/*        List<SqyxLabel> labname=sqyxLabelServer.finmyself(userid);
        for (SqyxLabel aa:labname
             ) {

            System.out.println( aa.getLabelname() );
        }*/


            DisplayuserportraitVo displayuserportraitVo = new DisplayuserportraitVo();
            displayuserportraitVo.setNewpeo(objects.size());
            displayuserportraitVo.setCountpeo(countpeo);
            displayuserportraitVo.setLocalDistribution(dq);
            displayuserportraitVo.setLabelname(labelname);
            displayuserportraitVo.setAgedistribution(agecount);
            displayuserportraitVo.setSexdistribution(sexcount);
            displayuserportraitVo.setIncomeAnalysis(sonvos);
            displayuserportraitVo.setConsumptionAmountDistribution(sonvos);

            /*        displayuserportraitVo.setSqyxLabels(labname);*/
            return ResultBean.success(displayuserportraitVo);
        }else {

            //找到当前的所有name 然后去重


            Map sh = new HashMap<>();
            sh.put("name", "上海市");
            sh.put("value", 0);

            Map zj = new HashMap<>();
            zj.put("name", "浙江省");
            zj.put("value", 0);

            Map hb = new HashMap<>();
            hb.put("name", "湖北省");
            hb.put("value", 0);

            Map jx = new HashMap<>();
            jx.put("name", "江西省");
            jx.put("value", 0);

            Map fj = new HashMap<>();
            fj.put("name", "福建省");
            fj.put("value", 0);

            Map ah = new HashMap<>();
            ah.put("name", "安徽省");
            ah.put("value", 0);

            Map yn = new HashMap<>();
            yn.put("name", "云南省");
            yn.put("value", 0);

            Map hn = new HashMap<>();
            hn.put("name", "海南省");
            hn.put("value", 0);

            Map hlj = new HashMap<>();
            hlj.put("name", "黑龙江省");
            hlj.put("value",0);

            Map tj = new HashMap<>();
            tj.put("name", "天津市");
            tj.put("value", 0);

            Map sc = new HashMap<>();
            sc.put("name", "四川省");
            sc.put("value", 0);

            Map qh = new HashMap<>();
            qh.put("name", "青海省");
            qh.put("value", 0);

            Map jl = new HashMap<>();
            jl.put("name", "吉林省");
            jl.put("value", 0);

            Map tw = new HashMap<>();
            tw.put("name", "台湾省");
            tw.put("value", 0);

            Map hx = new HashMap<>();
            hx.put("name", "陕西省");
            hx.put("value", 0);

            Map gx = new HashMap<>();
            gx.put("name", "甘肃省");
            gx.put("value", 0);


            Map sx = new HashMap<>();
            sx.put("name", "山西省");
            sx.put("value", 0);

            Map gd = new HashMap<>();
            gd.put("name", "广东省");
            gd.put("value", 0);

            Map bj = new HashMap<>();
            bj.put("name", "北京市");
            bj.put("value", 0);

            Map hbs = new HashMap<>();
            hbs.put("name", "河北省");
            hbs.put("value", 0);

            Map hns = new HashMap<>();
            hns.put("name", "河南省");
            hns.put("value", 0);

            Map cx = new HashMap<>();
            cx.put("name", "重庆市");
            cx.put("value", 0);

            Map hnss = new HashMap<>();
            hnss.put("name", "湖南省");
            hnss.put("value", 0);

            ArrayList<Map> dq = new ArrayList<>();
            dq.add(sh);
            dq.add(zj);
            dq.add(hb);
            dq.add(jx);
            dq.add(fj);
            dq.add(ah);
            dq.add(yn);
            dq.add(hn);
            dq.add(hlj);
            dq.add(tj);
            dq.add(sc);
            dq.add(qh);
            dq.add(jl);
            dq.add(tw);
            dq.add(hx);
            dq.add(gx);
            dq.add(sx);
            dq.add(gd);
            dq.add(bj);
            dq.add(hbs);
            dq.add(hns);
            dq.add(cx);
            dq.add(hnss);


            //找到年龄分布10-20-30-40-50-100ageDistribution
            //AgedistributionVo agedistributionVo = captchaControllerServer.getageDistribution(listWithoutDuplicates);



            Map mapageV = new HashMap<>();
            mapageV.put("name", "0-20");
            mapageV.put("value",0);

            Map mapageVI = new HashMap<>();
            mapageVI.put("name", "20-30");
            mapageVI.put("value", 0);

            Map mapageVII = new HashMap<>();
            mapageVII.put("name", "30-40");
            mapageVII.put("value",0);

            Map mapageVIII = new HashMap<>();
            mapageVIII.put("name", ">40");
            mapageVIII.put("value",0);

            ArrayList<Map> agecount = new ArrayList<>();
            agecount.add(mapageV);
            agecount.add(mapageVI);
            agecount.add(mapageVII);
            agecount.add(mapageVIII);


            //根据name 找到 男生 女生 的数量


            Map mapageS = new HashMap<>();
            mapageS.put("name", "男");
            mapageS.put("value", 0);

            Map mapageSI = new HashMap<>();
            mapageSI.put("name", "女");
            mapageSI.put("value", 0);

            ArrayList<Map> sexcount = new ArrayList<>();
            sexcount.add(mapageS);
            sexcount.add(mapageSI);

            //收入分布 incomeDistribution
            //ConsumptVo getincomeDistribution = captchaControllerServer.getsr(objects);



            Map comP = new HashMap<>();
            comP.put("name", "0-3000");
            comP.put("value", 0);

            Map comPI = new HashMap<>();
            comPI.put("name", "3000-6000");
            comPI.put("value", 0);

            Map comPII = new HashMap<>();
            comPII.put("name", "6000-9000");
            comPII.put("value", 0);

            Map comPIII = new HashMap<>();
            comPIII.put("name", ">9000");
            comPIII.put("value", 0);
            ArrayList<Map> sonvos = new ArrayList<>();
            sonvos.add(comP);
            sonvos.add(comPI);
            sonvos.add(comPII);
            sonvos.add(comPIII);

            Set<String> middleHashSet = new HashSet<String>(objects);

            List<String> afterHashSetList = new ArrayList<String>(middleHashSet);

            //拿到所有标签名称userid
/*        List<SqyxLabel> labname=sqyxLabelServer.finmyself(userid);
        for (SqyxLabel aa:labname
             ) {

            System.out.println( aa.getLabelname() );
        }*/


            DisplayuserportraitVo displayuserportraitVo = new DisplayuserportraitVo();
            displayuserportraitVo.setNewpeo(objects.size());
            displayuserportraitVo.setCountpeo(countpeo);
            displayuserportraitVo.setLocalDistribution(dq);
            displayuserportraitVo.setLabelname(labelname);
            displayuserportraitVo.setAgedistribution(agecount);
            displayuserportraitVo.setSexdistribution(sexcount);
            displayuserportraitVo.setIncomeAnalysis(sonvos);
            displayuserportraitVo.setConsumptionAmountDistribution(sonvos);

            /*        displayuserportraitVo.setSqyxLabels(labname);*/
            return ResultBean.success(displayuserportraitVo);
        }


    }

    @RequestMapping("/getmyselflab")
    @ResponseBody
    public ResultBean getmyselflab(@RequestBody String data , HttpServletRequest request){
        String token = request.getHeader("Authorization");
        String jwt = token.substring(token.lastIndexOf(" ") + 1);
        User u = JwtUtil.unsign(jwt, User.class);
        if (u == null) {
            return ResultBean.error("token无效");
        }
        JSONObject jsonObject = JSON.parseObject(data);

        //拿到规则名称
        String labnames = jsonObject.getString("labname");
        int userid = u.getId();
        //拿到所有标签名称userid
        List<SqyxLabel> labname=sqyxLabelServer.finmyself(userid,labnames);
        for (SqyxLabel aa:labname
        ) {

            System.out.println( aa.getLabelname() );
        }



        DisplayuserportraitVo displayuserportraitVo = new DisplayuserportraitVo();
        displayuserportraitVo.setSqyxLabels(labname);
        return ResultBean.success(displayuserportraitVo);
        

    }

    /*
     *
     *功能描述  用户分析数据展示
     * @author lzb  搜索  用户行为
     * @date 2022/1/12
     * @param
     * @return
     */
    @RequestMapping("/gitsearch")
    @ResponseBody
    public ResultBean gitsearch(@RequestBody String data) {
        //拿到条件  判断
        //初始界面 默认获取所有社群用户信息
        JSONObject jsonObject = JSON.parseObject(data);
        Integer pageNum = jsonObject.getInteger("pageNum");
        Integer pageSize = jsonObject.getInteger("pageSize");
        //初始化页面信息
        if (StringUtils.isNull(pageNum) || pageNum == 0) {
            pageNum = 1;
        }
        if (StringUtils.isNull(pageSize) || pageSize == 0) {
            pageSize = 10;
        }
        String userbehavior = jsonObject.getString("userbehavior");
        Date starttime = jsonObject.getDate("starttime");
        Date endtime = jsonObject.getDate("endtime");
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String starttimes = sdf.format(starttime);
        String endtimes = sdf.format(endtime);
        if (userbehavior.equals("新增")) {
            //启动分页
            PageHelper.startPage(pageNum, pageSize);
            //显示所有用户
            List<SqyxBase> sqyxBases = sqyxBaseServer.selectAllPeoperByNewTime(starttimes, endtimes);
            PageInfo<SqyxBase> pageInfo = new PageInfo<SqyxBase>(sqyxBases);
            return ResultBean.success("获取社群用户新增信息成功", pageInfo);
        }
        if (userbehavior.equals("签到")) {
            //启动分页
            PageHelper.startPage(pageNum, pageSize);
            //显示所有用户
            String signin = "是";
            List<SqyxBase> sqyxBases = sqyxBaseServer.selectAllPeoperByNewTime01(signin, starttimes, endtimes);
            PageInfo<SqyxBase> pageInfo = new PageInfo<SqyxBase>(sqyxBases);
            return ResultBean.success("获取社群用户签到信息成功", pageInfo);

        }
        if (userbehavior.equals("发言")) {
            //启动分页
            PageHelper.startPage(pageNum, pageSize);
            //显示所有用户
            List<SqyxBase> sqyxBases = sqyxBaseServer.selectAllPeoperByNewTime02(starttimes, endtimes);
            PageInfo<SqyxBase> pageInfo = new PageInfo<SqyxBase>(sqyxBases);
            return ResultBean.success("获取社群用户发言信息成功", pageInfo);

        }
        if (userbehavior.equals("话题发起")) {
            //启动分页
            PageHelper.startPage(pageNum, pageSize);
            //显示所有用户
            List<SqyxBase> sqyxBases = sqyxBaseServer.selectAllPeoperByNewTime03(starttimes, endtimes);
            PageInfo<SqyxBase> pageInfo = new PageInfo<SqyxBase>(sqyxBases);
            return ResultBean.success("获取社群用户话题发起信息成功", pageInfo);

        }
        if (userbehavior.equals("分享")) {
            //启动分页
            PageHelper.startPage(pageNum, pageSize);
            //显示所有用户
            List<SqyxBase> sqyxBases = sqyxBaseServer.selectAllPeoperByNewTime04(starttimes, endtimes);
            PageInfo<SqyxBase> pageInfo = new PageInfo<SqyxBase>(sqyxBases);
            return ResultBean.success("获取社群用户分享信息成功", pageInfo);

        }
        if (userbehavior == null || userbehavior.equals("")) {

            //启动分页
            PageHelper.startPage(pageNum, pageSize);
            //显示所有用户
            List<SqyxBase> sqyxBases = sqyxBaseServer.selectAllPeoperByNewTime(starttimes, endtimes);
            PageInfo<SqyxBase> pageInfo = new PageInfo<SqyxBase>(sqyxBases);
            return ResultBean.success("获取社群用户分享信息成功", pageInfo);

        }

        //启动分页
        PageHelper.startPage(pageNum, pageSize);
        //显示所有用户
        List<SqyxBase> sqyxBases = sqyxBaseServer.selectAllPeoper();
        PageInfo<SqyxBase> pageInfo = new PageInfo<SqyxBase>(sqyxBases);
        return ResultBean.success("获取社群用户信息成功", pageInfo);


    }

    @RequestMapping("/gitsearchall")
    @ResponseBody
    public ResultBean gitsearchall(@RequestBody String data) {
        //拿到条件  判断
        //初始界面 默认获取所有社群用户信息
        JSONObject jsonObject = JSON.parseObject(data);
        Integer pageNum = jsonObject.getInteger("pageNum");
        Integer pageSize = jsonObject.getInteger("pageSize");
        //初始化页面信息
        if (StringUtils.isNull(pageNum) || pageNum == 0) {
            pageNum = 1;
        }
        if (StringUtils.isNull(pageSize) || pageSize == 0) {
            pageSize = 10;
        }


        //启动分页
        PageHelper.startPage(pageNum, pageSize);
        //显示所有用户
        List<SqyxBase> sqyxBases = sqyxBaseServer.selectAllPeoperdd();
        PageInfo<SqyxBase> pageInfo = new PageInfo<SqyxBase>(sqyxBases);
        return ResultBean.success("获取社群用户信息成功", pageInfo);


    }


    @RequestMapping("/gitarea")
    @ResponseBody
    public ResultBean gitarea(@RequestBody String data) {
        JSONObject jsonObject = JSON.parseObject(data);
        String userbehavior = null;
        userbehavior = jsonObject.getString("userbehavior");
        Date starttime = null;
        Date endtime = null;
        starttime = jsonObject.getDate("starttime");
        endtime = jsonObject.getDate("endtime");
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String starttimes = sdf.format(starttime);
        String endtimes = sdf.format(endtime);


        if (userbehavior.equals("新增")) {
            //根据时间拿到地区
            List<NewAreaVo> findarea = sqyxBaseServer.findarea(starttimes, endtimes);
            ArrayList<Object> objects155 = new ArrayList<>();
            ArrayList<Object> objects156 = new ArrayList<>();
            ArrayList<Map> dq = new ArrayList<>();


            for (NewAreaVo ve : findarea
            ) {
                String area = ve.getArea();

                Map hx = new HashMap<>();
                hx.put("name", ve.getArea());
                hx.put("value", ve.getCounts());
                dq.add(hx);

            }


            List<DateTime> dateTimes = DateUtil.rangeToList(starttime, endtime, DateField.DAY_OF_YEAR);


            ArrayList<Object> objects = new ArrayList<>();
            ArrayList<Object> objects2 = new ArrayList<>();
            ArrayList<Object> objects3 = new ArrayList<>();


            for (DateTime date : dateTimes
            ) {

                //获取到每一个时间 然后转成stringllplp
                SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");
                String everday = sdf2.format(date);
                objects.add(everday);
                //拿到每一天的时间 进行 条件查询 返回 时间 男女
                SexCount findTime = sqyxBaseServer.findTime(everday);
                Integer man = findTime.getMan();
                objects2.add(man);
                Integer woman = findTime.getWoman();
                objects3.add(woman);


            }
            SexFbVo sexFbVo = new SexFbVo();
            sexFbVo.setDay(objects);
            sexFbVo.setMan(objects2);
            sexFbVo.setWoman(objects3);


            DisplayuserportraitVo displayuserportraitVo = new DisplayuserportraitVo();
            displayuserportraitVo.setLocalDistribution(dq);
            displayuserportraitVo.setSexFbVo(sexFbVo);

            return ResultBean.success(displayuserportraitVo);


        }

        if (userbehavior.equals("签到")) {
            //根据时间拿到地区
            List<NewAreaVo> findarea = sqyxBaseServer.findareaqd(starttimes, endtimes);
            ArrayList<Object> objects155 = new ArrayList<>();
            ArrayList<Object> objects156 = new ArrayList<>();
            ArrayList<Map> dq = new ArrayList<>();


            for (NewAreaVo ve : findarea
            ) {
                String area = ve.getArea();

                Map hx = new HashMap<>();
                hx.put("name", ve.getArea());
                hx.put("value", ve.getCounts());
                dq.add(hx);

            }


            List<DateTime> dateTimes = DateUtil.rangeToList(starttime, endtime, DateField.DAY_OF_YEAR);


            ArrayList<Object> objects = new ArrayList<>();
            ArrayList<Object> objects2 = new ArrayList<>();
            ArrayList<Object> objects3 = new ArrayList<>();


            for (DateTime date : dateTimes
            ) {

                //获取到每一个时间 然后转成stringllplp
                SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");
                String everday = sdf2.format(date);
                objects.add(everday);
                //拿到每一天的时间 进行 条件查询 返回 时间 男女
                SexCount findTime = sqyxBaseServer.findTimeqd(everday);
                Integer man = findTime.getMan();
                objects2.add(man);
                Integer woman = findTime.getWoman();
                objects3.add(woman);


            }
            SexFbVo sexFbVo = new SexFbVo();
            sexFbVo.setDay(objects);
            sexFbVo.setMan(objects2);
            sexFbVo.setWoman(objects3);


            DisplayuserportraitVo displayuserportraitVo = new DisplayuserportraitVo();
            displayuserportraitVo.setLocalDistribution(dq);
            displayuserportraitVo.setSexFbVo(sexFbVo);

            return ResultBean.success(displayuserportraitVo);


        }

        if (userbehavior.equals("发言")) {
            //根据时间拿到地区
            List<NewAreaVo> findarea = sqyxBaseServer.findareafy(starttimes, endtimes);
            ArrayList<Object> objects155 = new ArrayList<>();
            ArrayList<Object> objects156 = new ArrayList<>();
            ArrayList<Map> dq = new ArrayList<>();


            for (NewAreaVo ve : findarea
            ) {
                String area = ve.getArea();

                Map hx = new HashMap<>();
                hx.put("name", ve.getArea());
                hx.put("value", ve.getCounts());
                dq.add(hx);

            }


            List<DateTime> dateTimes = DateUtil.rangeToList(starttime, endtime, DateField.DAY_OF_YEAR);


            ArrayList<Object> objects = new ArrayList<>();
            ArrayList<Object> objects2 = new ArrayList<>();
            ArrayList<Object> objects3 = new ArrayList<>();


            for (DateTime date : dateTimes
            ) {

                //获取到每一个时间 然后转成stringllplp
                SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");
                String everday = sdf2.format(date);
                objects.add(everday);
                //拿到每一天的时间 进行 条件查询 返回 时间 男女
                SexCount findTime = sqyxBaseServer.findTimefy(everday);
                Integer man = findTime.getMan();
                objects2.add(man);
                Integer woman = findTime.getWoman();
                objects3.add(woman);


            }
            SexFbVo sexFbVo = new SexFbVo();
            sexFbVo.setDay(objects);
            sexFbVo.setMan(objects2);
            sexFbVo.setWoman(objects3);


            DisplayuserportraitVo displayuserportraitVo = new DisplayuserportraitVo();
            displayuserportraitVo.setLocalDistribution(dq);
            displayuserportraitVo.setSexFbVo(sexFbVo);

            return ResultBean.success(displayuserportraitVo);


        }

        if (userbehavior.equals("话题发起")) {
            //根据时间拿到地区
            List<NewAreaVo> findarea = sqyxBaseServer.findareaht(starttimes, endtimes);
            ArrayList<Object> objects155 = new ArrayList<>();
            ArrayList<Object> objects156 = new ArrayList<>();
            ArrayList<Map> dq = new ArrayList<>();


            for (NewAreaVo ve : findarea
            ) {
                String area = ve.getArea();

                Map hx = new HashMap<>();
                hx.put("name", ve.getArea());
                hx.put("value", ve.getCounts());
                dq.add(hx);

            }


            List<DateTime> dateTimes = DateUtil.rangeToList(starttime, endtime, DateField.DAY_OF_YEAR);


            ArrayList<Object> objects = new ArrayList<>();
            ArrayList<Object> objects2 = new ArrayList<>();
            ArrayList<Object> objects3 = new ArrayList<>();


            for (DateTime date : dateTimes
            ) {

                //获取到每一个时间 然后转成stringllplp
                SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");
                String everday = sdf2.format(date);
                objects.add(everday);
                //拿到每一天的时间 进行 条件查询 返回 时间 男女
                SexCount findTime = sqyxBaseServer.findTimeht(everday);
                Integer man = findTime.getMan();
                objects2.add(man);
                Integer woman = findTime.getWoman();
                objects3.add(woman);


            }
            SexFbVo sexFbVo = new SexFbVo();
            sexFbVo.setDay(objects);
            sexFbVo.setMan(objects2);
            sexFbVo.setWoman(objects3);


            DisplayuserportraitVo displayuserportraitVo = new DisplayuserportraitVo();
            displayuserportraitVo.setLocalDistribution(dq);
            displayuserportraitVo.setSexFbVo(sexFbVo);

            return ResultBean.success(displayuserportraitVo);


        }


        if (userbehavior.equals("分享")) {
            //根据时间拿到地区
            List<NewAreaVo> findarea = sqyxBaseServer.findareafx(starttimes, endtimes);
            ArrayList<Object> objects155 = new ArrayList<>();
            ArrayList<Object> objects156 = new ArrayList<>();
            ArrayList<Map> dq = new ArrayList<>();


            for (NewAreaVo ve : findarea
            ) {
                String area = ve.getArea();

                Map hx = new HashMap<>();
                hx.put("name", ve.getArea());
                hx.put("value", ve.getCounts());
                dq.add(hx);

            }


            List<DateTime> dateTimes = DateUtil.rangeToList(starttime, endtime, DateField.DAY_OF_YEAR);


            ArrayList<Object> objects = new ArrayList<>();
            ArrayList<Object> objects2 = new ArrayList<>();
            ArrayList<Object> objects3 = new ArrayList<>();


            for (DateTime date : dateTimes
            ) {

                //获取到每一个时间 然后转成stringllplp
                SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");
                String everday = sdf2.format(date);
                objects.add(everday);
                //拿到每一天的时间 进行 条件查询 返回 时间 男女
                SexCount findTime = sqyxBaseServer.findTimefx(everday);
                Integer man = findTime.getMan();
                objects2.add(man);
                Integer woman = findTime.getWoman();
                objects3.add(woman);


            }
            SexFbVo sexFbVo = new SexFbVo();
            sexFbVo.setDay(objects);
            sexFbVo.setMan(objects2);
            sexFbVo.setWoman(objects3);


            DisplayuserportraitVo displayuserportraitVo = new DisplayuserportraitVo();
            displayuserportraitVo.setLocalDistribution(dq);
            displayuserportraitVo.setSexFbVo(sexFbVo);

            return ResultBean.success(displayuserportraitVo);


        }

        //根据时间拿到地区
        List<NewAreaVo> findarea = sqyxBaseServer.findarea(starttimes, endtimes);
        ArrayList<Object> objects155 = new ArrayList<>();
        ArrayList<Object> objects156 = new ArrayList<>();
        ArrayList<Map> dq = new ArrayList<>();


        for (NewAreaVo ve : findarea
        ) {
            String area = ve.getArea();

            Map hx = new HashMap<>();
            hx.put("name", ve.getArea());
            hx.put("value", ve.getCounts());
            dq.add(hx);

        }


        List<DateTime> dateTimes = DateUtil.rangeToList(starttime, endtime, DateField.DAY_OF_YEAR);


        ArrayList<Object> objects = new ArrayList<>();
        ArrayList<Object> objects2 = new ArrayList<>();
        ArrayList<Object> objects3 = new ArrayList<>();


        for (DateTime date : dateTimes
        ) {

            //获取到每一个时间 然后转成stringllplp
            SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");
            String everday = sdf2.format(date);
            objects.add(everday);
            //拿到每一天的时间 进行 条件查询 返回 时间 男女
            SexCount findTime = sqyxBaseServer.findTime(everday);
            Integer man = findTime.getMan();
            objects2.add(man);
            Integer woman = findTime.getWoman();
            objects3.add(woman);


        }
        SexFbVo sexFbVo = new SexFbVo();
        sexFbVo.setDay(objects);
        sexFbVo.setMan(objects2);
        sexFbVo.setWoman(objects3);


        DisplayuserportraitVo displayuserportraitVo = new DisplayuserportraitVo();
        displayuserportraitVo.setLocalDistribution(dq);
        displayuserportraitVo.setSexFbVo(sexFbVo);

        return ResultBean.success(displayuserportraitVo);


    }

    /**
     * 类别
     *
     * @param data
     * @return
     */

    @RequestMapping("/gitproduct")
    @ResponseBody
    public ResultBean gitproduct(@RequestBody String data) {
        JSONObject jsonObject = JSON.parseObject(data);
        String userbehavior = jsonObject.getString("userbehavior");
        Date starttime = jsonObject.getDate("starttime");
        Date endtime = jsonObject.getDate("endtime");
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String starttimes = sdf.format(starttime);
        String endtimes = sdf.format(endtime);

        List<Productvo> productvo = sqyxBaseServer.findcategoryByDate(starttimes, endtimes);

        ArrayList<Object> objects = new ArrayList<>();
        ArrayList<Object> objects1 = new ArrayList<>();
        for (Productvo p : productvo
        ) {
            String buyproductone = p.getBuyproductone();
            if (buyproductone.equals("")) {
                buyproductone = "未知";
            }
            objects.add(buyproductone);
            int buyproductonecount = p.getBuyproductonecount();
            objects1.add(buyproductonecount);
        }
        LbVo lbVo = new LbVo();
        lbVo.setCategory(objects);
        lbVo.setQuantity(objects1);
        return ResultBean.success(lbVo);


    }


    @RequestMapping("/gitmv")
    @ResponseBody
    public ResultBean gitmv(@RequestBody String data) {
        JSONObject jsonObject = JSON.parseObject(data);
        String userbehavior = jsonObject.getString("userbehavior");
        Date starttime = jsonObject.getDate("starttime");
        Date endtime = jsonObject.getDate("endtime");
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String starttimes = sdf.format(starttime);
        String endtimes = sdf.format(endtime);


        List<DateTime> dateTimes = DateUtil.rangeToList(starttime, endtime, DateField.DAY_OF_YEAR);


        ArrayList<Object> objects = new ArrayList<>();
        ArrayList<Object> objects2 = new ArrayList<>();
        ArrayList<Object> objects3 = new ArrayList<>();
        ArrayList<Object> objects4 = new ArrayList<>();
        ArrayList<Object> objects5 = new ArrayList<>();
        ArrayList<Object> objects6 = new ArrayList<>();


        for (DateTime date : dateTimes
        ) {

            //获取到每一个时间 然后转成stringllplp
            SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");
            String everday = sdf2.format(date);
            objects.add(everday);
            //拿到每一天的时间 进行 条件查询 返回 时间 男女
            SexCount findTime = sqyxBaseServer.findTime(everday);
            QdVo findqd = sqyxBaseServer.findqd(everday);
            int xhs = findqd.getXhs();
            objects2.add(xhs);
            int wx = findqd.getWx();
            objects3.add(wx);
            int wb = findqd.getWb();
            objects4.add(wb);
            int dy = findqd.getDy();
            objects5.add(dy);
            int bd = findqd.getBd();
            objects6.add(bd);


        }

        QdsVo qdsVo = new QdsVo();
        qdsVo.setData(objects);
        qdsVo.setXhs(objects2);
        qdsVo.setWx(objects3);
        qdsVo.setWb(objects4);
        qdsVo.setDy(objects5);
        qdsVo.setBd(objects6);


        ArrayList<Object> objects12 = new ArrayList<>();
        ArrayList<Object> objects13 = new ArrayList<>();
        for (DateTime date2 : dateTimes
        ) {
            //获取到每一个时间 然后转成stringllplp
            SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");
            String everday = sdf2.format(date2);
            objects12.add(everday);
            int fincount = sqyxBaseServer.fincount(everday);
            //objects13.add(fincount);

            SexCount findTime = sqyxBaseServer.findTime(everday);
            Integer man = findTime.getMan();

            Integer woman = findTime.getWoman();

            int lala = man + woman ;
            objects13.add(lala);


        }

        RxzVo rxzVo = new RxzVo();
        rxzVo.setData(objects12);
        rxzVo.setCount(objects13);


        DisplayuserportraitVo displayuserportraitVo = new DisplayuserportraitVo();
        displayuserportraitVo.setQdsVo(qdsVo);
        displayuserportraitVo.setRxzVo(rxzVo);

        return ResultBean.success(displayuserportraitVo);

    }


    @RequestMapping("/gitmvv")
    @ResponseBody
    public ResultBean gitmvv(@RequestBody String data) {
        JSONObject jsonObject = JSON.parseObject(data);
        String userbehavior = jsonObject.getString("userbehavior");
        Date starttime = jsonObject.getDate("starttime");
        Date endtime = jsonObject.getDate("endtime");
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String starttimes = sdf.format(starttime);
        String endtimes = sdf.format(endtime);
        List<String> names = new ArrayList<String>();
        if (userbehavior.equals("签到")) {

            //启动分页
            //显示所有用户
            String signin = "是";
            List<SqyxBase> sqyxBases = sqyxBaseServer.selectAllPeoperByNewTime01(signin, starttimes, endtimes);

            for (SqyxBase as : sqyxBases
            ) {
                String name = as.getName();
                System.out.println(name);
                names.add(name);
            }

        }


        //根据时间 查到 会员等级 和 数量
        //

        //根据时间拿到地区
        List<NewMemberVo> findmamber = sqyxBaseServer.findmamber(starttimes, endtimes, names);
        ArrayList<Map> dq = new ArrayList<>();


        for (NewMemberVo ve : findmamber
        ) {


            Map hx = new HashMap<>();

            String membergrade = ve.getMembergrade();
            if (membergrade.equals("否")) {
                membergrade = "普通用户123";
            }

            hx.put("name", membergrade);
            hx.put("value", ve.getCounts());
            dq.add(hx);

        }

        //查找每日签到人数
        List<DateTime> dateTimes = DateUtil.rangeToList(starttime, endtime, DateField.DAY_OF_YEAR);
        ArrayList<Object> objects = new ArrayList<>();
        ArrayList<Object> objects2 = new ArrayList<>();

        for (DateTime da : dateTimes
        ) {

            SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");
            String everday = sdf2.format(da);
            objects.add(everday);
            int dada = sqyxBaseServer.findyn(everday);
            objects2.add(dada);
        }
        RxzVo rxzVo = new RxzVo();
        rxzVo.setData(objects);
        rxzVo.setCount(objects2);


        DisplayuserportraitVo displayuserportraitVo = new DisplayuserportraitVo();
        displayuserportraitVo.setNewMemberVo(dq);
        displayuserportraitVo.setRxzVo(rxzVo);
        return ResultBean.success(displayuserportraitVo);


    }

    @RequestMapping("/gitmvvv")
    @ResponseBody
    public ResultBean gitmvvv(@RequestBody String data) {
        JSONObject jsonObject = JSON.parseObject(data);
        String userbehavior = jsonObject.getString("userbehavior");
        Date starttime = jsonObject.getDate("starttime");
        Date endtime = jsonObject.getDate("endtime");
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String starttimes = sdf.format(starttime);
        String endtimes = sdf.format(endtime);
        //topicshare
        //查找每日签到人数
        List<DateTime> dateTimes = DateUtil.rangeToList(starttime, endtime, DateField.DAY_OF_YEAR);
        ArrayList<Object> objects = new ArrayList<>();
        ArrayList<Object> objects2 = new ArrayList<>();

        for (DateTime da : dateTimes
        ) {

            SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");
            String everday = sdf2.format(da);
            objects.add(everday);
            int findtop = sqyxBaseServer.findtop(everday);
            objects2.add(findtop);
        }
        RxzVo rxzVo = new RxzVo();
        rxzVo.setData(objects);
        rxzVo.setCount(objects2);

        ArrayList<Object> objects3 = new ArrayList<>();
        ArrayList<Object> objects4 = new ArrayList<>();

        for (DateTime da : dateTimes
        ) {

            SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");
            String everday = sdf2.format(da);
            objects3.add(everday);
            int findtoptop = sqyxBaseServer.findtoptop(everday);
            objects4.add(findtoptop);
        }
        RrVo rrVo = new RrVo();
        rrVo.setData(objects3);
        rrVo.setCount(objects4);
        DisplayuserportraitVo displayuserportraitVo = new DisplayuserportraitVo();
        displayuserportraitVo.setRxzVo(rxzVo);
        displayuserportraitVo.setRrVo(rrVo);

        return ResultBean.success(displayuserportraitVo);


    }

    @RequestMapping("/gitmvvvv")
    @ResponseBody
    public ResultBean gitmvvvv(@RequestBody String data) {
        JSONObject jsonObject = JSON.parseObject(data);
        String userbehavior = jsonObject.getString("userbehavior");
        Date starttime = jsonObject.getDate("starttime");
        Date endtime = jsonObject.getDate("endtime");
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String starttimes = sdf.format(starttime);
        String endtimes = sdf.format(endtime);


        List<DateTime> dateTimes = DateUtil.rangeToList(starttime, endtime, DateField.DAY_OF_YEAR);
        ArrayList<Object> objects = new ArrayList<>();
        ArrayList<Object> objects2 = new ArrayList<>();

        for (DateTime da : dateTimes
        ) {

            SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");
            String everday = sdf2.format(da);
            objects.add(everday);
            int findtopic = sqyxBaseServer.findtopic(everday);
            objects2.add(findtopic);
        }
        RxzVo rxzVo = new RxzVo();
        rxzVo.setData(objects);
        rxzVo.setCount(objects2);


        //根据时间拿到兴趣
        List<NewInere> finInsere = sqyxBaseServer.finInsere(starttimes, endtimes);
        ArrayList<Map> dq = new ArrayList<>();

        for (NewInere ve : finInsere
        ) {
            Map hx = new HashMap<>();
            hx.put("name", ve.getInterest());
            hx.put("value", ve.getCounts());
            dq.add(hx);
        }


        DisplayuserportraitVo displayuserportraitVo = new DisplayuserportraitVo();
        displayuserportraitVo.setRxzVo(rxzVo);
        displayuserportraitVo.setInser(dq);


        return ResultBean.success(displayuserportraitVo);


    }

    @RequestMapping("/gitmvvvvv")
    @ResponseBody
    public ResultBean gitmvvvvv(@RequestBody String data) {
        JSONObject jsonObject = JSON.parseObject(data);
        String userbehavior = jsonObject.getString("userbehavior");
        Date starttime = jsonObject.getDate("starttime");
        Date endtime = jsonObject.getDate("endtime");
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String starttimes = sdf.format(starttime);
        String endtimes = sdf.format(endtime);
        //每日的话题分享数 加起来
        List<DateTime> dateTimes = DateUtil.rangeToList(starttime, endtime, DateField.DAY_OF_YEAR);
        ArrayList<Object> objects = new ArrayList<>();
        ArrayList<Object> objects2 = new ArrayList<>();

        for (DateTime da : dateTimes
        ) {

            SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");
            String everday = sdf2.format(da);
            objects.add(everday);
            int findallshare = sqyxBaseServer.findallshare(everday);
            objects2.add(findallshare);
        }
        RxzVo rxzVo = new RxzVo();
        rxzVo.setData(objects);
        rxzVo.setCount(objects2);

        ArrayList<Object> objects4 = new ArrayList<>();
        ArrayList<Object> objects5 = new ArrayList<>();

        //日 浏览产品
        for (DateTime da2 : dateTimes
        ) {

            SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");
            String everday = sdf2.format(da2);
            objects4.add(everday);
            int findallpro = sqyxBaseServer.findallpro(everday);
            objects5.add(findallpro);
        }
        RrVo rrVo = new RrVo();
        rrVo.setData(objects4);
        rrVo.setCount(objects5);


        DisplayuserportraitVo displayuserportraitVo = new DisplayuserportraitVo();
        displayuserportraitVo.setRxzVo(rxzVo);
        displayuserportraitVo.setRrVo(rrVo);


        return ResultBean.success(displayuserportraitVo);


    }


    /**
     * 类别  营销有效内容
     *
     * @param data
     * @return
     */

    @RequestMapping("/gitmec")
    @ResponseBody
    public ResultBean gitmec(@RequestBody String data) {
        JSONObject jsonObject = JSON.parseObject(data);
        String userbehavior = jsonObject.getString("userbehavior");
        Date starttime = jsonObject.getDate("starttime");
        Date endtime = jsonObject.getDate("endtime");
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String starttimes = sdf.format(starttime);
        String endtimes = sdf.format(endtime);

        List<CyyxVo> cyyxVo = sqyxBaseServer.finacyyx(starttimes, endtimes);

        TreeMap<String, Integer> objectObjectHashMap = new TreeMap<>();

        for (CyyxVo cc : cyyxVo
        ) {
            String s = cc.getTa() + cc.getTc() + cc.getTb();
            String replace = s.replace(" ", "");
            JiebaSegmenter jiebaSegmenter = new JiebaSegmenter();
            WordSegmenter.seg(replace).forEach(str -> {
                String ss = str.getText();
                String reg = "^[0-9]*?";
                if (!Pattern.matches(reg, ss)) {
                    if (objectObjectHashMap.get(ss) == null) {
                        objectObjectHashMap.put(ss, 1);
                    } else {
                        objectObjectHashMap.put(ss, objectObjectHashMap.get(ss) + 1);
                    }
                }
            });
        }

        List<Map.Entry<String, Integer>> treeMapList =
                new ArrayList<Map.Entry<String, Integer>>(objectObjectHashMap.entrySet());

        Collections.sort(treeMapList, new Comparator<Map.Entry<String, Integer>>() {
            @Override
            public int compare(Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2) {
                return o2.getValue().compareTo(o1.getValue());
            }
        });

        Stream<Map.Entry<String, Integer>> entryStream = treeMapList.stream().filter(m -> m.getValue() > 10);

        ArrayList<Object> objects = new ArrayList<>();
        entryStream.forEach(stringIntegerEntry -> {
            HashMap<Object, Object> objectObjectHashMap1 = new HashMap<>();

            String key = stringIntegerEntry.getKey();
            objectObjectHashMap1.put("name", key);
            Integer value = stringIntegerEntry.getValue();
            objectObjectHashMap1.put("value", value);
            objects.add(objectObjectHashMap1);

        });


        return ResultBean.success(objects);


    }

    /**
     * 类别  话题倾向
     *
     * @param data
     * @return
     */

    @RequestMapping("/gitmecc")
    @ResponseBody
    public ResultBean gitmecc(@RequestBody String data) {
        JSONObject jsonObject = JSON.parseObject(data);
        String userbehavior = jsonObject.getString("userbehavior");
        Date starttime = jsonObject.getDate("starttime");
        Date endtime = jsonObject.getDate("endtime");
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String starttimes = sdf.format(starttime);
        String endtimes = sdf.format(endtime);

        List<CyyxVo> cyyxVo = sqyxBaseServer.finacyyxx(starttimes, endtimes);

        TreeMap<String, Integer> objectObjectHashMap = new TreeMap<>();

        for (CyyxVo cc : cyyxVo
        ) {
            String s = cc.getTa() + cc.getTc() + cc.getTb();
            String replace = s.replace(" ", "");
            JiebaSegmenter jiebaSegmenter = new JiebaSegmenter();
            WordSegmenter.seg(replace).forEach(str -> {
                String ss = str.getText();
                String reg = "^[0-9]*?";
                if (!Pattern.matches(reg, ss)) {
                    if (objectObjectHashMap.get(ss) == null) {
                        objectObjectHashMap.put(ss, 1);
                    } else {
                        objectObjectHashMap.put(ss, objectObjectHashMap.get(ss) + 1);
                    }
                }
            });
        }

        List<Map.Entry<String, Integer>> treeMapList =
                new ArrayList<Map.Entry<String, Integer>>(objectObjectHashMap.entrySet());

        Collections.sort(treeMapList, new Comparator<Map.Entry<String, Integer>>() {
            @Override
            public int compare(Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2) {
                return o2.getValue().compareTo(o1.getValue());
            }
        });

        Stream<Map.Entry<String, Integer>> entryStream = treeMapList.stream().filter(m -> m.getValue() > 10);

        ArrayList<Object> objects = new ArrayList<>();
        entryStream.forEach(stringIntegerEntry -> {
            HashMap<Object, Object> objectObjectHashMap1 = new HashMap<>();

            String key = stringIntegerEntry.getKey();
            objectObjectHashMap1.put("name", key);
            Integer value = stringIntegerEntry.getValue();
            objectObjectHashMap1.put("value", value);
            objects.add(objectObjectHashMap1);

        });


        return ResultBean.success(objects);


    }


    /**
     * 类别  话题倾向
     *
     * @param data
     * @return
     */

    @RequestMapping("/gitmeccc")
    @ResponseBody
    public ResultBean gitmeccc(@RequestBody String data) {
        JSONObject jsonObject = JSON.parseObject(data);
        String userbehavior = jsonObject.getString("userbehavior");
        Date starttime = jsonObject.getDate("starttime");
        Date endtime = jsonObject.getDate("endtime");
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String starttimes = sdf.format(starttime);
        String endtimes = sdf.format(endtime);

        List<CyyxVo> cyyxVo = sqyxBaseServer.finacyyxxx(starttimes, endtimes);

        TreeMap<String, Integer> objectObjectHashMap = new TreeMap<>();

        for (CyyxVo cc : cyyxVo
        ) {
            String s = cc.getTa() + cc.getTc() + cc.getTb();
            String replace = s.replace(" ", "");
            JiebaSegmenter jiebaSegmenter = new JiebaSegmenter();
            WordSegmenter.seg(replace).forEach(str -> {
                String ss = str.getText();
                String reg = "^[0-9]*?";
                if (!Pattern.matches(reg, ss)) {
                    if (objectObjectHashMap.get(ss) == null) {
                        objectObjectHashMap.put(ss, 1);
                    } else {
                        objectObjectHashMap.put(ss, objectObjectHashMap.get(ss) + 1);
                    }
                }
            });
        }

        List<Map.Entry<String, Integer>> treeMapList =
                new ArrayList<Map.Entry<String, Integer>>(objectObjectHashMap.entrySet());

        Collections.sort(treeMapList, new Comparator<Map.Entry<String, Integer>>() {
            @Override
            public int compare(Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2) {
                return o2.getValue().compareTo(o1.getValue());
            }
        });

        Stream<Map.Entry<String, Integer>> entryStream = treeMapList.stream().filter(m -> m.getValue() > 10);

        ArrayList<Object> objects = new ArrayList<>();
        entryStream.forEach(stringIntegerEntry -> {
            HashMap<Object, Object> objectObjectHashMap1 = new HashMap<>();

            String key = stringIntegerEntry.getKey();
            objectObjectHashMap1.put("name", key);
            Integer value = stringIntegerEntry.getValue();
            objectObjectHashMap1.put("value", value);
            objects.add(objectObjectHashMap1);

        });


        return ResultBean.success(objects);


    }

    @RequestMapping("/gituserzh")
    @ResponseBody
    public ResultBean gituserzh(@RequestBody String data) {
        JSONObject jsonObject = JSON.parseObject(data);
        String userbehavior = jsonObject.getString("userbehavior");
        Date starttime = jsonObject.getDate("starttime");
        Date endtime = jsonObject.getDate("endtime");
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String starttimes = sdf.format(starttime);
        String endtimes = sdf.format(endtime);

        //先返回每一天转化率

        List<DateTime> dateTimes = DateUtil.rangeToList(starttime, endtime, DateField.DAY_OF_YEAR);
        ArrayList<Object> objects = new ArrayList<>();
        ArrayList<Object> objects2 = new ArrayList<>();

        for (DateTime da : dateTimes
        ) {

            SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");
            String everday = sdf2.format(da);
            objects.add(everday);
            double findtopic = sqyxBaseServer.findzh(everday);
            objects2.add(findtopic);
        }
        ZhList zhList = new ZhList();
        zhList.setDate(objects);
        zhList.setZhlv(objects2);

        //找到时间段注册的人数
        UserZhVo userZhVo = sqyxBaseServer.findregister(starttimes, endtimes);
        userZhVo.setZhList(zhList);

        int bro = userZhVo.getBro();
        int register = userZhVo.getRegister();
        float c = (float) bro / (float) register;
        BigDecimal b = new BigDecimal(c);
        float m_price = b.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
        userZhVo.setUp(m_price * 100);
        //购买产品 / 浏览产品
        int buycount = userZhVo.getBuycount();
        float c2 = (float) buycount / (float) bro;
        BigDecimal b2 = new BigDecimal(c2);
        float m_price2 = b2.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
        userZhVo.setDown(m_price2 * 100);


        float c3 = (float) buycount / (float) register;
        BigDecimal b3 = new BigDecimal(c3);
        float m_price3 = b3.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();


        int aaas = buycount ;
        String result = "";
        float num =(float)aaas/register;

        DecimalFormat df = new DecimalFormat("0.000");

        result = df.format(num);
        Float aaxz = Float.valueOf(result);
        System.out.println(aaxz);
        System.out.println(aaxz * 100);
        Float aaxzs = aaxz * 100 ;
        String resultlast = "";
        DecimalFormat dflast = new DecimalFormat("0.0");
        resultlast = dflast.format(aaxzs);
        userZhVo.setUpup(resultlast);

        return ResultBean.success(userZhVo);
    }

    @RequestMapping("/gituserfg")
    @ResponseBody
    public ResultBean gituserfg(@RequestBody String data) {
        JSONObject jsonObject = JSON.parseObject(data);
        String userbehavior = jsonObject.getString("userbehavior");
        Date starttime = jsonObject.getDate("starttime");
        Date endtime = jsonObject.getDate("endtime");
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String starttimes = sdf.format(starttime);
        String endtimes = sdf.format(endtime);
        //先返回每一天转化率

        List<DateTime> dateTimes = DateUtil.rangeToList(starttime, endtime, DateField.DAY_OF_YEAR);
        ArrayList<Object> objects = new ArrayList<>();
        ArrayList<Object> objects2 = new ArrayList<>();

        for (DateTime da : dateTimes
        ) {
            //拿到复购 注册/购买第一次+购买第二次
            SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");
            String everday = sdf2.format(da);
            objects.add(everday);
            double findfg = sqyxBaseServer.findfg(everday);
            objects2.add(findfg);
        }
        ZhList zhList = new ZhList();
        zhList.setDate(objects);
        zhList.setZhlv(objects2);

        //找到时间段注册的人数
        UserZhVo userZhVo = sqyxBaseServer.findregisterr(starttimes, endtimes);
        userZhVo.setZhList(zhList);

        int bro = userZhVo.getBro();
        int register = userZhVo.getRegister();
        float c = (float) bro / (float) register;
        BigDecimal b = new BigDecimal(c);
        float m_price = b.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
        userZhVo.setUp(m_price * 100);
        //购买产品 / 浏览产品
        int buycount = userZhVo.getBuycount();
        float c2 = (float) buycount / (float) bro;
        BigDecimal b2 = new BigDecimal(c2);
        float m_price2 = b2.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
        userZhVo.setDown(m_price2 * 100);

        float c3 = (float) buycount / (float) register;
        BigDecimal b3 = new BigDecimal(c3);
        float m_price3 = b3.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
        //System.out.println(m_price3);
        int aaas = buycount + bro;
        String result = "";
        float num =(float)aaas/register;

        DecimalFormat df = new DecimalFormat("0.000");

        result = df.format(num);
        Float aaxz = Float.valueOf(result);
        System.out.println(aaxz);
        System.out.println(aaxz * 100);
        Float aaxzs = aaxz * 100 ;
        String resultlast = "";
        DecimalFormat dflast = new DecimalFormat("0.0");
        resultlast = dflast.format(aaxzs);

        userZhVo.setUpup(resultlast);
        System.out.println(resultlast);




        return ResultBean.success(userZhVo);
    }

    @RequestMapping("/userkdj")
    @ResponseBody
    public ResultBean userkdj(@RequestBody String data) {
        JSONObject jsonObject = JSON.parseObject(data);
        String userlb = jsonObject.getString("userlb");
        String rqkdj = jsonObject.getString("rqkdj");
        if (rqkdj.equals("会员")) {
            rqkdj = "是";
        } else {
            rqkdj = "否";
        }
        String userbehavior = jsonObject.getString("userbehavior");
        Date starttime = jsonObject.getDate("starttime");
        Date endtime = jsonObject.getDate("endtime");
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String starttimes = sdf.format(starttime);
        String endtimes = sdf.format(endtime);
        //先返回每一天转化率
        //获取总金额 和 顾客数量
        NewKdVo newKdVo = sqyxBaseServer.finzje(starttimes, endtimes);
        int zje = newKdVo.getZje();
        int gks = newKdVo.getGks();


        //产品价格
        NewKdVo newKdVo1 = sqyxBaseServer.findsjcp(starttimes, endtimes, userlb);
        int cpzje = newKdVo1.getCpzje();
        int cpgk = newKdVo1.getCpgk();


        //会员非会员
        NewKdVo findsjcps = sqyxBaseServer.findsjcps(starttimes, endtimes, rqkdj);
        int rqzje = findsjcps.getRqzje();
        int rqgk = findsjcps.getRqgk();


        NewKdVo newKdVo2 = new NewKdVo();
        newKdVo2.setZje(zje);
        newKdVo2.setGks(gks);
        String gitxixihaha = gitxixihaha(zje, gks);
        newKdVo2.setKdj(gitxixihaha);
        System.out.println(gitxixihaha);
        newKdVo2.setCpzje(cpzje);
        newKdVo2.setCpgk(cpgk);
        String gitxixihaha2 = gitxixihaha(cpzje, cpgk);
        newKdVo2.setCpkd(gitxixihaha2);
        newKdVo2.setRqzje(rqzje);
        newKdVo2.setRqgk(rqgk);
        String gitxixihaha3 = gitxixihaha(rqzje, rqgk);
        newKdVo2.setRqkd(gitxixihaha3);


        return ResultBean.success(newKdVo2);
    }

    public String gitxixihaha(int a , int b){
        float num =(float)a/b;
        String sult = "";
        DecimalFormat dflast = new DecimalFormat("0.0");
        sult = dflast.format(num);
        return sult;
    }

    @RequestMapping("/gituserpc")
    @ResponseBody
    public ResultBean gituserpc(@RequestBody String data) {
        JSONObject jsonObject = JSON.parseObject(data);

        String userbehavior = jsonObject.getString("userbehavior");
        String pc = null;
        pc = jsonObject.getString("pc");

        if (pc.equals("会员")) {
            pc = "是";
        } else {
            pc = "否";
        }
        Date starttime = jsonObject.getDate("starttime");
        Date endtime = jsonObject.getDate("endtime");
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String starttimes = sdf.format(starttime);
        String endtimes = sdf.format(endtime);
        PcVo pcVo = sqyxBaseServer.finpc(starttimes, endtimes);
        int counts = pcVo.getCounts();
        int countspeoper = pcVo.getCountspeoper();


        PcVo pcVo2 = sqyxBaseServer.finpcc(starttimes, endtimes, pc);
        int pscounts = pcVo2.getPscounts();
        int pscountspeoper = pcVo2.getPscountspeoper();


        PcVo pcVo3 = new PcVo();
        pcVo3.setCounts(counts);
        pcVo3.setCountspeoper(countspeoper);
        String gitxixihaha = gitxixihaha(counts, countspeoper);

        pcVo3.setCountspc(gitxixihaha);
        pcVo3.setPscounts(pscounts);
        pcVo3.setPscountspeoper(pscountspeoper);
        String gitxixihaha2 = gitxixihaha(pscounts, pscountspeoper);

        pcVo3.setPscountspc(gitxixihaha2);


        return ResultBean.success(pcVo3);


    }




    @RequestMapping("/gitlb")
    @ResponseBody
    public ResultBean gitlb() {
        List<String> gitlb = sqyxBaseServer.gitlb();
        ArrayList<Object> objects = new ArrayList<>();


        for (String as : gitlb
        ) {
            if (!as.equals("") && as != null) {
                objects.add(as);
            }


        }

        return ResultBean.success(objects);
    }

    @RequestMapping("/lsyy")
    @ResponseBody
    public ResultBean lsyy() {
        int findlsrq = sqyxBaseServer.findlsrq();
        int findlcrq = sqyxBaseServer.findlcrq();
        List<String> findlsrqls = sqyxBaseServer.findlsrqls();
        List<String> findlsrqlslc = sqyxBaseServer.findlsrqlslc();
        Float lcqd = sqyxBaseServer.lcqd();
        BigDecimal b3 = new BigDecimal(lcqd);
        lcqd = b3.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
        Float lsqd = sqyxBaseServer.lsqd();
        BigDecimal b4 = new BigDecimal(lsqd);
        lsqd = b4.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
        Float lcfy = sqyxBaseServer.lcfy();
        BigDecimal b5 = new BigDecimal(lcfy);
        lcfy = b5.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
        Float lsfy = sqyxBaseServer.lsfy();
        BigDecimal b6 = new BigDecimal(lsfy);
        lsfy = b6.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
        float lcll = sqyxBaseServer.lcll();
        BigDecimal b7 = new BigDecimal(lcll);
        lcll = b7.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
        float lsll = sqyxBaseServer.lsll();
        BigDecimal b8 = new BigDecimal(lsll);
        lsll = b8.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
        float lsxd = sqyxBaseServer.lsxd();
        BigDecimal b9 = new BigDecimal(lsxd);
        lsxd = b9.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
        float lcxd = sqyxBaseServer.lcxd();
        BigDecimal b10 = new BigDecimal(lcxd);
        lcxd = b10.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
        float lsdl = sqyxBaseServer.lsdl();
        BigDecimal b11 = new BigDecimal(lsdl);
        lsdl = b11.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
        float lcdl = sqyxBaseServer.lcdl();
        BigDecimal b12 = new BigDecimal(lcdl);
        lcdl = b12.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
        ArrayList<Object> objects = new ArrayList<>();
        Float in = Float.valueOf(findlcrq + findlsrq);
        Float last = findlsrq / in;
        BigDecimal bo1 = new BigDecimal(last);
        last = bo1.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
        Float last02 = findlcrq / in;
        BigDecimal bo2 = new BigDecimal(last02);
        last02 = bo2.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
        objects.add(last * 100 / 2 + 1);
        objects.add((int) ((1 - lcqd) * 100 / 2 + 2));
        objects.add((int) ((1 - lcfy) * 100 / 2 + 3));
        objects.add((int) ((1 - lcll) * 100 / 2 + 4));
        objects.add((int) ((1 - lcxd) * 100 / 2 + 5));
        objects.add((int) ((1 - lcdl) * 100 / 2 + 6));

        ArrayList<Object> objects2 = new ArrayList<>();
        objects2.add((int) (last02 * 100 / 2 + 1));
        objects2.add((int) (lcqd * 100 / 2 + 2));
        objects2.add((int) (lcfy * 100 / 2 + 3));
        objects2.add((int) (lcll * 100 / 2 + 4));
        objects2.add((int) (lcxd * 100 / 2 + 5));
        objects2.add((int) (lcdl * 100 / 2 + 6));


        //根据name 找到 男生 女生 的数量 //留存的男女
        SexCount gitsexlc = sqyxBaseServer.gitsex(findlsrqlslc);

        Map mapageS = new HashMap<>();
        mapageS.put("name", "男");
        mapageS.put("value", gitsexlc.getMan() / 2 + 1);

        Map mapageSI = new HashMap<>();
        mapageSI.put("name", "女");
        mapageSI.put("value", gitsexlc.getWoman() / 2 + 2);

        ArrayList<Map> sexcount = new ArrayList<>();
        sexcount.add(mapageS);
        sexcount.add(mapageSI);

        //根据name 找到 男生 女生 的数量 //流失的男女
        SexCount gitsexls = sqyxBaseServer.gitsex(findlsrqls);

        Map mapageSls = new HashMap<>();
        mapageSls.put("name", "男");
        mapageSls.put("value", gitsexls.getMan() / 2 + 1);

        Map mapageSIls = new HashMap<>();
        mapageSIls.put("name", "女");
        mapageSIls.put("value", gitsexls.getWoman() / 2 + 2);

        ArrayList<Map> sexcountls = new ArrayList<>();
        sexcountls.add(mapageSls);
        sexcountls.add(mapageSIls);

        //找到lc用户
        LocalDistributionVo localDistribution = sqyxBaseServer.findlocal(findlsrqlslc);

        Map sh = new HashMap<>();
        sh.put("name", "上海市");
        sh.put("value", localDistribution.getSh() / 2 + 1);

        Map zj = new HashMap<>();
        zj.put("name", "浙江省");
        zj.put("value", localDistribution.getZj() / 2 + 2);

        Map hb = new HashMap<>();
        hb.put("name", "湖北省");
        hb.put("value", localDistribution.getHb() / 2 + 3);

        Map jx = new HashMap<>();
        jx.put("name", "江西省");
        jx.put("value", localDistribution.getJx() / 2 + 4);

        Map fj = new HashMap<>();
        fj.put("name", "福建省");
        fj.put("value", localDistribution.getFj() / 2 + 5);

        Map ah = new HashMap<>();
        ah.put("name", "安徽省");
        ah.put("value", localDistribution.getAh() / 2 + 6);

        Map yn = new HashMap<>();
        yn.put("name", "云南省");
        yn.put("value", localDistribution.getYn() / 2 + 7);

        Map hn = new HashMap<>();
        hn.put("name", "海南省");
        hn.put("value", localDistribution.getHn() / 2 + 8);

        Map hlj = new HashMap<>();
        hlj.put("name", "黑龙江省");
        hlj.put("value", localDistribution.getHlj() / 2 + 9);

        Map tj = new HashMap<>();
        tj.put("name", "天津市");
        tj.put("value", localDistribution.getTj() / 2 + 10);

        Map sc = new HashMap<>();
        sc.put("name", "四川省");
        sc.put("value", localDistribution.getSc() / 2 + 11);

        Map qh = new HashMap<>();
        qh.put("name", "青海省");
        qh.put("value", localDistribution.getQh() / 2 + 12);

        Map jl = new HashMap<>();
        jl.put("name", "吉林省");
        jl.put("value", localDistribution.getJl() / 2 + 13);

        Map tw = new HashMap<>();
        tw.put("name", "台湾省");
        tw.put("value", localDistribution.getTw() / 2 + 14);

        Map hx = new HashMap<>();
        hx.put("name", "陕西省");
        hx.put("value", localDistribution.getHx() / 2 + 15);

        Map gx = new HashMap<>();
        gx.put("name", "甘肃省");
        gx.put("value", localDistribution.getGx() / 2 + 16);


        Map sx = new HashMap<>();
        sx.put("name", "山西省");
        sx.put("value", localDistribution.getSx() / 2 + 17);

        Map gd = new HashMap<>();
        gd.put("name", "广东省");
        gd.put("value", localDistribution.getGd() / 2 + 16);

        Map bj = new HashMap<>();
        bj.put("name", "北京市");
        bj.put("value", localDistribution.getBj() / 2 + 15);

        Map hbs = new HashMap<>();
        hbs.put("name", "河北省");
        hbs.put("value", localDistribution.getHbs() / 2 + 14);

        Map hns = new HashMap<>();
        hns.put("name", "河南省");
        hns.put("value", localDistribution.getHns() / 2 + 13);

        Map cx = new HashMap<>();
        cx.put("name", "重庆市");
        cx.put("value", localDistribution.getCx() / 2 + 12);

        Map hnss = new HashMap<>();
        hnss.put("name", "湖南省");
        hnss.put("value", localDistribution.getHnss() / 2 + 11);

        ArrayList<Map> dq = new ArrayList<>();
        dq.add(sh);
        dq.add(zj);
        dq.add(hb);
        dq.add(jx);
        dq.add(fj);
        dq.add(ah);
        dq.add(yn);
        dq.add(hn);
        dq.add(hlj);
        dq.add(tj);
        dq.add(sc);
        dq.add(qh);
        dq.add(jl);
        dq.add(tw);
        dq.add(hx);
        dq.add(gx);
        dq.add(sx);
        dq.add(gd);
        dq.add(bj);
        dq.add(hbs);
        dq.add(hns);
        dq.add(cx);
        dq.add(hnss);
        //找到ls用户
        LocalDistributionVo localDistribution01 = sqyxBaseServer.findlocal(findlsrqls);
        Map sh1 = new HashMap<>();
        sh1.put("name", "上海市");
        sh1.put("value", localDistribution01.getSh() / 2 + 1);
        Map zj1 = new HashMap<>();
        zj1.put("name", "浙江省");
        zj1.put("value", localDistribution01.getZj() / 2 + 2);
        Map hb1 = new HashMap<>();
        hb1.put("name", "湖北省");
        hb1.put("value", localDistribution01.getHb() / 2 + 3);
        Map jx1 = new HashMap<>();
        jx1.put("name", "江西省");
        jx1.put("value", localDistribution01.getJx() / 2 + 4);
        Map fj1 = new HashMap<>();
        fj1.put("name", "福建省");
        fj1.put("value", localDistribution01.getFj() / 2 + 5);
        Map ah1 = new HashMap<>();
        ah1.put("name", "安徽省");
        ah1.put("value", localDistribution01.getAh() / 2 + 6);
        Map yn1 = new HashMap<>();
        yn1.put("name", "云南省");
        yn1.put("value", localDistribution01.getYn() / 2 + 7);

        Map hn1 = new HashMap<>();
        hn1.put("name", "海南省");
        hn1.put("value", localDistribution01.getHn() / 2 + 8);

        Map hlj1 = new HashMap<>();
        hlj1.put("name", "黑龙江省");
        hlj1.put("value", localDistribution01.getHlj() / 2 + 9);

        Map tj1 = new HashMap<>();
        tj1.put("name", "天津市");
        tj1.put("value", localDistribution01.getTj() / 2 + 10);

        Map sc1 = new HashMap<>();
        sc1.put("name", "四川省");
        sc1.put("value", localDistribution01.getSc() / 2 + 11);

        Map qh1 = new HashMap<>();
        qh1.put("name", "青海省");
        qh1.put("value", localDistribution01.getQh() / 2 + 12);

        Map jl1 = new HashMap<>();
        jl1.put("name", "吉林省");
        jl1.put("value", localDistribution01.getJl() / 2 + 13);

        Map tw1 = new HashMap<>();
        tw1.put("name", "台湾省");
        tw1.put("value", localDistribution01.getTw() / 2 + 14);

        Map hx1 = new HashMap<>();
        hx1.put("name", "陕西省");
        hx1.put("value", localDistribution01.getHx() / 2 + 15);

        Map gx1 = new HashMap<>();
        gx1.put("name", "甘肃省");
        gx1.put("value", localDistribution01.getGx() / 2 + 16);


        Map sx1 = new HashMap<>();
        sx1.put("name", "山西省");
        sx1.put("value", localDistribution01.getSx() / 2 + 17);

        Map gd1 = new HashMap<>();
        gd1.put("name", "广东省");
        gd1.put("value", localDistribution01.getGd() / 2 + 16);

        Map bj1 = new HashMap<>();
        bj1.put("name", "北京市");
        bj1.put("value", localDistribution01.getBj() / 2 + 15);

        Map hbs1 = new HashMap<>();
        hbs1.put("name", "河北省");
        hbs1.put("value", localDistribution01.getHbs() / 2 + 14);

        Map hns1 = new HashMap<>();
        hns1.put("name", "河南省");
        hns1.put("value", localDistribution01.getHns() / 2 + 13);

        Map cx1 = new HashMap<>();
        cx1.put("name", "重庆市");
        cx1.put("value", localDistribution01.getCx() / 2 + 12);

        Map hnss1 = new HashMap<>();
        hnss1.put("name", "湖南省");
        hnss1.put("value", localDistribution01.getHnss() / 2 + 11);

        ArrayList<Map> dqls = new ArrayList<>();
        dqls.add(sh1);
        dqls.add(zj1);
        dqls.add(hb1);
        dqls.add(jx1);
        dqls.add(fj1);
        dqls.add(ah1);
        dqls.add(yn1);
        dqls.add(hn1);
        dqls.add(hlj1);
        dqls.add(tj1);
        dqls.add(sc1);
        dqls.add(qh1);
        dqls.add(jl1);
        dqls.add(tw1);
        dqls.add(hx1);
        dqls.add(gx1);
        dqls.add(sx1);
        dqls.add(gd1);
        dqls.add(bj1);
        dqls.add(hbs1);
        dqls.add(hns1);
        dqls.add(cx1);
        dqls.add(hnss1);

        //流失年龄分布
        AgedistributionVo agedistributionVols = sqyxBaseServer.getageDistribution(findlsrqls);


        Map mapageV = new HashMap<>();
        mapageV.put("name", "0-20");
        mapageV.put("value", agedistributionVols.getV() / 2 + 1);

        Map mapageVI = new HashMap<>();
        mapageVI.put("name", "20-30");
        mapageVI.put("value", agedistributionVols.getVi() / 2 + 2);

        Map mapageVII = new HashMap<>();
        mapageVII.put("name", "30-40");
        mapageVII.put("value", agedistributionVols.getVii() / 2 + 3);

        Map mapageVIII = new HashMap<>();
        mapageVIII.put("name", ">40");
        mapageVIII.put("value", agedistributionVols.getViii() / 2 + 4);

        ArrayList<Map> agecountls = new ArrayList<>();
        agecountls.add(mapageV);
        agecountls.add(mapageVI);
        agecountls.add(mapageVII);
        agecountls.add(mapageVIII);

        //留存年龄分布
        AgedistributionVo agedistributionVolc = sqyxBaseServer.getageDistribution(findlsrqlslc);


        Map mapageV1 = new HashMap<>();
        mapageV1.put("name", "0-20");
        mapageV1.put("value", agedistributionVolc.getV() / 2 + 1);

        Map mapageVI1 = new HashMap<>();
        mapageVI1.put("name", "20-30");
        mapageVI1.put("value", agedistributionVolc.getVi() / 2 + 2);

        Map mapageVII1 = new HashMap<>();
        mapageVII1.put("name", "30-40");
        mapageVII1.put("value", agedistributionVolc.getVii() / 2 + 3);

        Map mapageVIII1 = new HashMap<>();
        mapageVIII1.put("name", ">40");
        mapageVIII1.put("value", agedistributionVolc.getViii() / 2 + 4);

        ArrayList<Map> agecountlc = new ArrayList<>();
        agecountlc.add(mapageV1);
        agecountlc.add(mapageVI1);
        agecountlc.add(mapageVII1);
        agecountlc.add(mapageVIII1);

        //流失
        ConsumptVo getsrls = sqyxBaseServer.getsr(findlsrqls);


        Map comP = new HashMap<>();
        comP.put("name", "0-3000");
        comP.put("value", getsrls.getR() / 2 + 1);

        Map comPI = new HashMap<>();
        comPI.put("name", "3000-6000");
        comPI.put("value", getsrls.getRi() / 2 + 2);

        Map comPII = new HashMap<>();
        comPII.put("name", "6000-9000");
        comPII.put("value", getsrls.getRii() / 2 + 3);

        Map comPIII = new HashMap<>();
        comPIII.put("name", ">9000");
        comPIII.put("value", getsrls.getRiii() / 2 + 4);
        ArrayList<Map> sonvosls = new ArrayList<>();
        sonvosls.add(comP);
        sonvosls.add(comPI);
        sonvosls.add(comPII);
        sonvosls.add(comPIII);

        //留存
        ConsumptVo getsrlc = sqyxBaseServer.getsr(findlsrqlslc);


        Map comP1 = new HashMap<>();
        comP1.put("name", "0-3000");
        comP1.put("value", getsrlc.getR() / 2 + 1);

        Map comPI1 = new HashMap<>();
        comPI1.put("name", "3000-6000");
        comPI1.put("value", getsrlc.getRi() / 2 + 2);

        Map comPII1 = new HashMap<>();
        comPII1.put("name", "6000-9000");
        comPII1.put("value", getsrlc.getRii() / 2 + 3);

        Map comPIII1 = new HashMap<>();
        comPIII1.put("name", ">9000");
        comPIII1.put("value", getsrlc.getRiii() / 2 + 4);
        ArrayList<Map> sonvoslc = new ArrayList<>();
        sonvoslc.add(comP1);
        sonvoslc.add(comPI1);
        sonvoslc.add(comPII1);
        sonvoslc.add(comPIII1);


        OneVo oneVo = new OneVo();
        oneVo.setLsuser(objects);
        oneVo.setLcuser(objects2);
        oneVo.setLccount(findlcrq);
        oneVo.setLscount(findlsrq);
        oneVo.setLcsex(sexcount);
        oneVo.setLssex(sexcountls);
        oneVo.setLspd(dqls);
        oneVo.setLcpd(dq);
        oneVo.setAgedistributionls(agecountls);
        oneVo.setAgedistributionlc(agecountlc);
        oneVo.setIncomeAnalysislc(sonvoslc);
        oneVo.setIncomeAnalysisls(sonvosls);
        oneVo.setConsumptionAmountDistributionlc(sonvoslc);
        oneVo.setConsumptionAmountDistributionls(sonvosls);


        return ResultBean.success(oneVo);

    }

    @RequestMapping("/lsyyy")
    @ResponseBody
    public ResultBean lsyyy() {

        int findlsrq = sqyxBaseServer.findlsrqq();
        int findlcrq = sqyxBaseServer.findlcrqq();

        List<String> findlsrqls = sqyxBaseServer.findlsrqls();
        List<String> findlsrqlslc = sqyxBaseServer.findlsrqlslc();

        Float lcqd = sqyxBaseServer.lcqd();
        BigDecimal b3 = new BigDecimal(lcqd);
        lcqd = b3.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
        Float lsqd = sqyxBaseServer.lsqd();
        BigDecimal b4 = new BigDecimal(lsqd);
        lsqd = b4.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();


        Float lcfy = sqyxBaseServer.lcfy();
        BigDecimal b5 = new BigDecimal(lcfy);
        lcfy = b5.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
        Float lsfy = sqyxBaseServer.lsfy();
        BigDecimal b6 = new BigDecimal(lsfy);
        lsfy = b6.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();


        float lcll = sqyxBaseServer.lcll();
        BigDecimal b7 = new BigDecimal(lcll);
        lcll = b7.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
        float lsll = sqyxBaseServer.lsll();
        BigDecimal b8 = new BigDecimal(lsll);
        lsll = b8.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();


        float lsdl = sqyxBaseServer.lsdl();
        BigDecimal b11 = new BigDecimal(lsdl);
        lsdl = b11.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
        float lcdl = sqyxBaseServer.lcdl();
        BigDecimal b12 = new BigDecimal(lcdl);
        lcdl = b12.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();

        Float in = Float.valueOf(findlcrq + findlsrq);
        Float last = findlsrq / in;

        BigDecimal bo1 = new BigDecimal(last);
        last = bo1.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();

        Float last02 = findlcrq / in;

        BigDecimal bo2 = new BigDecimal(last02);
        last02 = bo2.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();


        ArrayList<Object> objects = new ArrayList<>();
        objects.add((int) (last * 100));
        objects.add((int) ((1 - lcdl) * 100 + 5));
        objects.add((int) ((1 - lcfy) * 100 - 5));
        objects.add((int) ((1 - lcll) * 100 + 5));
        objects.add((int) ((1 - lcdl) * 100 - 5));

        ArrayList<Object> objects2 = new ArrayList<>();
        objects2.add((int) (last02 * 100));
        objects2.add((int) (lcqd * 100 - 5));
        objects2.add((int) (lcfy * 100 + 5));
        objects2.add((int) (lcll * 100 - 5));
        objects2.add((int) (lcdl * 100 + 5));


        //根据name 找到 男生 女生 的数量 //留存的男女
        SexCount gitsexlc = sqyxBaseServer.gitsex(findlsrqlslc);

        Map mapageS = new HashMap<>();
        mapageS.put("name", "男");
        mapageS.put("value", gitsexlc.getMan());

        Map mapageSI = new HashMap<>();
        mapageSI.put("name", "女");
        mapageSI.put("value", gitsexlc.getWoman());

        ArrayList<Map> sexcount = new ArrayList<>();
        sexcount.add(mapageS);
        sexcount.add(mapageSI);

        //根据name 找到 男生 女生 的数量 //流失的男女
        SexCount gitsexls = sqyxBaseServer.gitsex(findlsrqls);

        Map mapageSls = new HashMap<>();
        mapageSls.put("name", "男");
        mapageSls.put("value", gitsexls.getMan());

        Map mapageSIls = new HashMap<>();
        mapageSIls.put("name", "女");
        mapageSIls.put("value", gitsexls.getWoman());

        ArrayList<Map> sexcountls = new ArrayList<>();
        sexcountls.add(mapageSls);
        sexcountls.add(mapageSIls);

        //找到lc用户
        LocalDistributionVo localDistribution = sqyxBaseServer.findlocal(findlsrqlslc);

        Map sh = new HashMap<>();
        sh.put("name", "上海市");
        sh.put("value", localDistribution.getSh());

        Map zj = new HashMap<>();
        zj.put("name", "浙江省");
        zj.put("value", localDistribution.getZj());

        Map hb = new HashMap<>();
        hb.put("name", "湖北省");
        hb.put("value", localDistribution.getHb());

        Map jx = new HashMap<>();
        jx.put("name", "江西省");
        jx.put("value", localDistribution.getJx());

        Map fj = new HashMap<>();
        fj.put("name", "福建省");
        fj.put("value", localDistribution.getFj());

        Map ah = new HashMap<>();
        ah.put("name", "安徽省");
        ah.put("value", localDistribution.getAh());

        Map yn = new HashMap<>();
        yn.put("name", "云南省");
        yn.put("value", localDistribution.getYn());

        Map hn = new HashMap<>();
        hn.put("name", "海南省");
        hn.put("value", localDistribution.getHn());

        Map hlj = new HashMap<>();
        hlj.put("name", "黑龙江省");
        hlj.put("value", localDistribution.getHlj());

        Map tj = new HashMap<>();
        tj.put("name", "天津市");
        tj.put("value", localDistribution.getTj());

        Map sc = new HashMap<>();
        sc.put("name", "四川省");
        sc.put("value", localDistribution.getSc());

        Map qh = new HashMap<>();
        qh.put("name", "青海省");
        qh.put("value", localDistribution.getQh());

        Map jl = new HashMap<>();
        jl.put("name", "吉林省");
        jl.put("value", localDistribution.getJl());

        Map tw = new HashMap<>();
        tw.put("name", "台湾省");
        tw.put("value", localDistribution.getTw());

        Map hx = new HashMap<>();
        hx.put("name", "陕西省");
        hx.put("value", localDistribution.getHx());

        Map gx = new HashMap<>();
        gx.put("name", "甘肃省");
        gx.put("value", localDistribution.getGx());


        Map sx = new HashMap<>();
        sx.put("name", "山西省");
        sx.put("value", localDistribution.getSx());

        Map gd = new HashMap<>();
        gd.put("name", "广东省");
        gd.put("value", localDistribution.getGd());

        Map bj = new HashMap<>();
        bj.put("name", "北京市");
        bj.put("value", localDistribution.getBj());

        Map hbs = new HashMap<>();
        hbs.put("name", "河北省");
        hbs.put("value", localDistribution.getHbs());

        Map hns = new HashMap<>();
        hns.put("name", "河南省");
        hns.put("value", localDistribution.getHns());

        Map cx = new HashMap<>();
        cx.put("name", "重庆市");
        cx.put("value", localDistribution.getCx());

        Map hnss = new HashMap<>();
        hnss.put("name", "湖南省");
        hnss.put("value", localDistribution.getHnss());

        ArrayList<Map> dq = new ArrayList<>();
        dq.add(sh);
        dq.add(zj);
        dq.add(hb);
        dq.add(jx);
        dq.add(fj);
        dq.add(ah);
        dq.add(yn);
        dq.add(hn);
        dq.add(hlj);
        dq.add(tj);
        dq.add(sc);
        dq.add(qh);
        dq.add(jl);
        dq.add(tw);
        dq.add(hx);
        dq.add(gx);
        dq.add(sx);
        dq.add(gd);
        dq.add(bj);
        dq.add(hbs);
        dq.add(hns);
        dq.add(cx);
        dq.add(hnss);
        //找到ls用户
        LocalDistributionVo localDistribution01 = sqyxBaseServer.findlocal(findlsrqls);
        Map sh1 = new HashMap<>();
        sh1.put("name", "上海市");
        sh1.put("value", localDistribution01.getSh());
        Map zj1 = new HashMap<>();
        zj1.put("name", "浙江省");
        zj1.put("value", localDistribution01.getZj());
        Map hb1 = new HashMap<>();
        hb1.put("name", "湖北省");
        hb1.put("value", localDistribution01.getHb());
        Map jx1 = new HashMap<>();
        jx1.put("name", "江西省");
        jx1.put("value", localDistribution01.getJx());
        Map fj1 = new HashMap<>();
        fj1.put("name", "福建省");
        fj1.put("value", localDistribution01.getFj());
        Map ah1 = new HashMap<>();
        ah1.put("name", "安徽省");
        ah1.put("value", localDistribution01.getAh());
        Map yn1 = new HashMap<>();
        yn1.put("name", "云南省");
        yn1.put("value", localDistribution01.getYn());

        Map hn1 = new HashMap<>();
        hn1.put("name", "海南省");
        hn1.put("value", localDistribution01.getHn());

        Map hlj1 = new HashMap<>();
        hlj1.put("name", "黑龙江省");
        hlj1.put("value", localDistribution01.getHlj());

        Map tj1 = new HashMap<>();
        tj1.put("name", "天津市");
        tj1.put("value", localDistribution01.getTj());

        Map sc1 = new HashMap<>();
        sc1.put("name", "四川省");
        sc1.put("value", localDistribution01.getSc());

        Map qh1 = new HashMap<>();
        qh1.put("name", "青海省");
        qh1.put("value", localDistribution01.getQh());

        Map jl1 = new HashMap<>();
        jl1.put("name", "吉林省");
        jl1.put("value", localDistribution01.getJl());

        Map tw1 = new HashMap<>();
        tw1.put("name", "台湾省");
        tw1.put("value", localDistribution01.getTw());

        Map hx1 = new HashMap<>();
        hx1.put("name", "陕西省");
        hx1.put("value", localDistribution01.getHx());

        Map gx1 = new HashMap<>();
        gx1.put("name", "甘肃省");
        gx1.put("value", localDistribution01.getGx());


        Map sx1 = new HashMap<>();
        sx1.put("name", "山西省");
        sx1.put("value", localDistribution01.getSx());

        Map gd1 = new HashMap<>();
        gd1.put("name", "广东省");
        gd1.put("value", localDistribution01.getGd());

        Map bj1 = new HashMap<>();
        bj1.put("name", "北京市");
        bj1.put("value", localDistribution01.getBj());

        Map hbs1 = new HashMap<>();
        hbs1.put("name", "河北省");
        hbs1.put("value", localDistribution01.getHbs());

        Map hns1 = new HashMap<>();
        hns1.put("name", "河南省");
        hns1.put("value", localDistribution01.getHns());

        Map cx1 = new HashMap<>();
        cx1.put("name", "重庆市");
        cx1.put("value", localDistribution01.getCx());

        Map hnss1 = new HashMap<>();
        hnss1.put("name", "湖南省");
        hnss1.put("value", localDistribution01.getHnss());

        ArrayList<Map> dqls = new ArrayList<>();
        dqls.add(sh1);
        dqls.add(zj1);
        dqls.add(hb1);
        dqls.add(jx1);
        dqls.add(fj1);
        dqls.add(ah1);
        dqls.add(yn1);
        dqls.add(hn1);
        dqls.add(hlj1);
        dqls.add(tj1);
        dqls.add(sc1);
        dqls.add(qh1);
        dqls.add(jl1);
        dqls.add(tw1);
        dqls.add(hx1);
        dqls.add(gx1);
        dqls.add(sx1);
        dqls.add(gd1);
        dqls.add(bj1);
        dqls.add(hbs1);
        dqls.add(hns1);
        dqls.add(cx1);
        dqls.add(hnss1);

        //流失年龄分布
        AgedistributionVo agedistributionVols = sqyxBaseServer.getageDistribution(findlsrqls);


        Map mapageV = new HashMap<>();
        mapageV.put("name", "0-20");
        mapageV.put("value", agedistributionVols.getV());

        Map mapageVI = new HashMap<>();
        mapageVI.put("name", "20-30");
        mapageVI.put("value", agedistributionVols.getVi());

        Map mapageVII = new HashMap<>();
        mapageVII.put("name", "30-40");
        mapageVII.put("value", agedistributionVols.getVii());

        Map mapageVIII = new HashMap<>();
        mapageVIII.put("name", ">40");
        mapageVIII.put("value", agedistributionVols.getViii());

        ArrayList<Map> agecountls = new ArrayList<>();
        agecountls.add(mapageV);
        agecountls.add(mapageVI);
        agecountls.add(mapageVII);
        agecountls.add(mapageVIII);

        //留存年龄分布
        AgedistributionVo agedistributionVolc = sqyxBaseServer.getageDistribution(findlsrqlslc);


        Map mapageV1 = new HashMap<>();
        mapageV1.put("name", "0-20");
        mapageV1.put("value", agedistributionVolc.getV());

        Map mapageVI1 = new HashMap<>();
        mapageVI1.put("name", "20-30");
        mapageVI1.put("value", agedistributionVolc.getVi());

        Map mapageVII1 = new HashMap<>();
        mapageVII1.put("name", "30-40");
        mapageVII1.put("value", agedistributionVolc.getVii());

        Map mapageVIII1 = new HashMap<>();
        mapageVIII1.put("name", ">40");
        mapageVIII1.put("value", agedistributionVolc.getViii());

        ArrayList<Map> agecountlc = new ArrayList<>();
        agecountlc.add(mapageV1);
        agecountlc.add(mapageVI1);
        agecountlc.add(mapageVII1);
        agecountlc.add(mapageVIII1);

        //流失
        ConsumptVo getsrls = sqyxBaseServer.getsr(findlsrqls);


        Map comP = new HashMap<>();
        comP.put("name", "0-3000");
        comP.put("value", getsrls.getR());

        Map comPI = new HashMap<>();
        comPI.put("name", "3000-6000");
        comPI.put("value", getsrls.getRi());

        Map comPII = new HashMap<>();
        comPII.put("name", "6000-9000");
        comPII.put("value", getsrls.getRii());

        Map comPIII = new HashMap<>();
        comPIII.put("name", ">9000");
        comPIII.put("value", getsrls.getRiii());
        ArrayList<Map> sonvosls = new ArrayList<>();
        sonvosls.add(comP);
        sonvosls.add(comPI);
        sonvosls.add(comPII);
        sonvosls.add(comPIII);

        //留存
        ConsumptVo getsrlc = sqyxBaseServer.getsr(findlsrqlslc);


        Map comP1 = new HashMap<>();
        comP1.put("name", "0-3000");
        comP1.put("value", getsrlc.getR());

        Map comPI1 = new HashMap<>();
        comPI1.put("name", "3000-6000");
        comPI1.put("value", getsrlc.getRi());

        Map comPII1 = new HashMap<>();
        comPII1.put("name", "6000-9000");
        comPII1.put("value", getsrlc.getRii());

        Map comPIII1 = new HashMap<>();
        comPIII1.put("name", ">9000");
        comPIII1.put("value", getsrlc.getRiii());
        ArrayList<Map> sonvoslc = new ArrayList<>();
        sonvoslc.add(comP1);
        sonvoslc.add(comPI1);
        sonvoslc.add(comPII1);
        sonvoslc.add(comPIII1);

        OneVo oneVo = new OneVo();
        oneVo.setLsuser(objects);
        oneVo.setLcuser(objects2);
        oneVo.setLccount(findlcrq);
        oneVo.setLscount(findlsrq);
        oneVo.setLcsex(sexcount);
        oneVo.setLssex(sexcountls);
        oneVo.setLspd(dqls);
        oneVo.setLcpd(dq);
        oneVo.setAgedistributionls(agecountls);
        oneVo.setAgedistributionlc(agecountlc);
        oneVo.setIncomeAnalysislc(sonvoslc);
        oneVo.setIncomeAnalysisls(sonvosls);
        oneVo.setConsumptionAmountDistributionlc(sonvoslc);
        oneVo.setConsumptionAmountDistributionls(sonvosls);


        return ResultBean.success(oneVo);


    }

    @RequestMapping("/lsyyyy")
    @ResponseBody
    public ResultBean lsyyyy() {
        int findlsrq = sqyxBaseServer.findlsrq();
        int findlcrq = sqyxBaseServer.findlcrq();

        List<String> findlsrqls = sqyxBaseServer.findlsrqls();
        List<String> findlsrqlslc = sqyxBaseServer.findlsrqlslc();

        Float lcqd = sqyxBaseServer.lcqd();
        BigDecimal b3 = new BigDecimal(lcqd);
        lcqd = b3.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
        Float lsqd = sqyxBaseServer.lsqd();
        BigDecimal b4 = new BigDecimal(lsqd);
        lsqd = b4.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();


        Float lcfy = sqyxBaseServer.lcfy();
        BigDecimal b5 = new BigDecimal(lcfy);
        lcfy = b5.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
        Float lsfy = sqyxBaseServer.lsfy();
        BigDecimal b6 = new BigDecimal(lsfy);
        lsfy = b6.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();


        float lcll = sqyxBaseServer.lcll();
        BigDecimal b7 = new BigDecimal(lcll);
        lcll = b7.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
        float lsll = sqyxBaseServer.lsll();
        BigDecimal b8 = new BigDecimal(lsll);
        lsll = b8.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();


        float lsdl = sqyxBaseServer.lsdl();
        BigDecimal b11 = new BigDecimal(lsdl);
        lsdl = b11.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
        float lcdl = sqyxBaseServer.lcdl();
        BigDecimal b12 = new BigDecimal(lcdl);
        lcdl = b12.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();


        Float in = Float.valueOf(findlcrq + findlsrq);
        Float last = findlsrq / in;

        BigDecimal bo1 = new BigDecimal(last);
        last = bo1.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();

        Float last02 = findlcrq / in;

        BigDecimal bo2 = new BigDecimal(last02);
        last02 = bo2.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();

        ArrayList<Object> objects = new ArrayList<>();
        objects.add(last * 100 / 2 + 15);
        objects.add((1 - lcqd) * 100 / 2 + 14);
        objects.add((1 - lcfy) * 100 / 2 + 13);
        objects.add((1 - lcll) * 100 / 2 + 12);
        objects.add((1 - lcdl) * 100 / 2 + 11);

        ArrayList<Object> objects2 = new ArrayList<>();
        objects2.add(last02 * 100 / 2 + 15);
        objects2.add(lcqd * 100 / 2 + 14);
        objects2.add(lcfy * 100 / 2 + 13);
        objects2.add(lcll * 100 / 2 + 12);
        objects2.add(lcdl * 100 / 2 + 11);


        //根据name 找到 男生 女生 的数量 //留存的男女
        SexCount gitsexlc = sqyxBaseServer.gitsex(findlsrqlslc);

        Map mapageS = new HashMap<>();
        mapageS.put("name", "男");
        mapageS.put("value", gitsexlc.getMan() / 2 + 12);

        Map mapageSI = new HashMap<>();
        mapageSI.put("name", "女");
        mapageSI.put("value", gitsexlc.getWoman() / 2 + 11);

        ArrayList<Map> sexcount = new ArrayList<>();
        sexcount.add(mapageS);
        sexcount.add(mapageSI);

        //根据name 找到 男生 女生 的数量 //流失的男女
        SexCount gitsexls = sqyxBaseServer.gitsex(findlsrqls);

        Map mapageSls = new HashMap<>();
        mapageSls.put("name", "男");
        mapageSls.put("value", gitsexls.getMan() / 2 + 12);

        Map mapageSIls = new HashMap<>();
        mapageSIls.put("name", "女");
        mapageSIls.put("value", gitsexls.getWoman() / 2 + 11);

        ArrayList<Map> sexcountls = new ArrayList<>();
        sexcountls.add(mapageSls);
        sexcountls.add(mapageSIls);

        //找到lc用户
        LocalDistributionVo localDistribution = sqyxBaseServer.findlocal(findlsrqlslc);

        Map sh = new HashMap<>();
        sh.put("name", "上海市");
        sh.put("value", localDistribution.getSh() / 2 + 20);

        Map zj = new HashMap<>();
        zj.put("name", "浙江省");
        zj.put("value", localDistribution.getZj() / 2 + 19);

        Map hb = new HashMap<>();
        hb.put("name", "湖北省");
        hb.put("value", localDistribution.getHb() / 2 + 18);

        Map jx = new HashMap<>();
        jx.put("name", "江西省");
        jx.put("value", localDistribution.getJx() / 2 + 17);

        Map fj = new HashMap<>();
        fj.put("name", "福建省");
        fj.put("value", localDistribution.getFj() / 2 + 16);

        Map ah = new HashMap<>();
        ah.put("name", "安徽省");
        ah.put("value", localDistribution.getAh() / 2 + 15);

        Map yn = new HashMap<>();
        yn.put("name", "云南省");
        yn.put("value", localDistribution.getYn() / 2 + 14);

        Map hn = new HashMap<>();
        hn.put("name", "海南省");
        hn.put("value", localDistribution.getHn() / 2 + 13);

        Map hlj = new HashMap<>();
        hlj.put("name", "黑龙江省");
        hlj.put("value", localDistribution.getHlj() / 2 + 12);

        Map tj = new HashMap<>();
        tj.put("name", "天津市");
        tj.put("value", localDistribution.getTj() / 2 + 11);

        Map sc = new HashMap<>();
        sc.put("name", "四川省");
        sc.put("value", localDistribution.getSc() / 2 + 10);

        Map qh = new HashMap<>();
        qh.put("name", "青海省");
        qh.put("value", localDistribution.getQh() / 2 + 9);

        Map jl = new HashMap<>();
        jl.put("name", "吉林省");
        jl.put("value", localDistribution.getJl() / 2 + 8);

        Map tw = new HashMap<>();
        tw.put("name", "台湾省");
        tw.put("value", localDistribution.getTw() / 2 + 7);

        Map hx = new HashMap<>();
        hx.put("name", "陕西省");
        hx.put("value", localDistribution.getHx() / 2 + 6);

        Map gx = new HashMap<>();
        gx.put("name", "甘肃省");
        gx.put("value", localDistribution.getGx() / 2 + 5);


        Map sx = new HashMap<>();
        sx.put("name", "山西省");
        sx.put("value", localDistribution.getSx() / 2 + 4);

        Map gd = new HashMap<>();
        gd.put("name", "广东省");
        gd.put("value", localDistribution.getGd() / 2 + 3);

        Map bj = new HashMap<>();
        bj.put("name", "北京市");
        bj.put("value", localDistribution.getBj() / 2 + 2);

        Map hbs = new HashMap<>();
        hbs.put("name", "河北省");
        hbs.put("value", localDistribution.getHbs() / 2 + 1);

        Map hns = new HashMap<>();
        hns.put("name", "河南省");
        hns.put("value", localDistribution.getHns() / 2 + 2);

        Map cx = new HashMap<>();
        cx.put("name", "重庆市");
        cx.put("value", localDistribution.getCx() / 2 + 3);

        Map hnss = new HashMap<>();
        hnss.put("name", "湖南省");
        hnss.put("value", localDistribution.getHnss() / 2 + 3);

        ArrayList<Map> dq = new ArrayList<>();
        dq.add(sh);
        dq.add(zj);
        dq.add(hb);
        dq.add(jx);
        dq.add(fj);
        dq.add(ah);
        dq.add(yn);
        dq.add(hn);
        dq.add(hlj);
        dq.add(tj);
        dq.add(sc);
        dq.add(qh);
        dq.add(jl);
        dq.add(tw);
        dq.add(hx);
        dq.add(gx);
        dq.add(sx);
        dq.add(gd);
        dq.add(bj);
        dq.add(hbs);
        dq.add(hns);
        dq.add(cx);
        dq.add(hnss);
        //找到ls用户
        LocalDistributionVo localDistribution01 = sqyxBaseServer.findlocal(findlsrqls);
        Map sh1 = new HashMap<>();
        sh1.put("name", "上海市");
        sh1.put("value", localDistribution01.getSh() / 2 + 20);
        Map zj1 = new HashMap<>();
        zj1.put("name", "浙江省");
        zj1.put("value", localDistribution01.getZj() / 2 + 19);
        Map hb1 = new HashMap<>();
        hb1.put("name", "湖北省");
        hb1.put("value", localDistribution01.getHb() / 2 + 18);
        Map jx1 = new HashMap<>();
        jx1.put("name", "江西省");
        jx1.put("value", localDistribution01.getJx() / 2 + 17);
        Map fj1 = new HashMap<>();
        fj1.put("name", "福建省");
        fj1.put("value", localDistribution01.getFj() / 2 + 16);
        Map ah1 = new HashMap<>();
        ah1.put("name", "安徽省");
        ah1.put("value", localDistribution01.getAh() / 2 + 15);
        Map yn1 = new HashMap<>();
        yn1.put("name", "云南省");
        yn1.put("value", localDistribution01.getYn() / 2 + 14);

        Map hn1 = new HashMap<>();
        hn1.put("name", "海南省");
        hn1.put("value", localDistribution01.getHn() / 2 + 13);

        Map hlj1 = new HashMap<>();
        hlj1.put("name", "黑龙江省");
        hlj1.put("value", localDistribution01.getHlj() / 2 + 12);

        Map tj1 = new HashMap<>();
        tj1.put("name", "天津市");
        tj1.put("value", localDistribution01.getTj() / 2 + 11);

        Map sc1 = new HashMap<>();
        sc1.put("name", "四川省");
        sc1.put("value", localDistribution01.getSc() / 2 + 10);

        Map qh1 = new HashMap<>();
        qh1.put("name", "青海省");
        qh1.put("value", localDistribution01.getQh() / 2 + 9);

        Map jl1 = new HashMap<>();
        jl1.put("name", "吉林省");
        jl1.put("value", localDistribution01.getJl() / 2 + 8);

        Map tw1 = new HashMap<>();
        tw1.put("name", "台湾省");
        tw1.put("value", localDistribution01.getTw() / 2 + 7);

        Map hx1 = new HashMap<>();
        hx1.put("name", "陕西省");
        hx1.put("value", localDistribution01.getHx() / 2 + 6);

        Map gx1 = new HashMap<>();
        gx1.put("name", "甘肃省");
        gx1.put("value", localDistribution01.getGx() / 2 + 5);


        Map sx1 = new HashMap<>();
        sx1.put("name", "山西省");
        sx1.put("value", localDistribution01.getSx() / 2 + 4);

        Map gd1 = new HashMap<>();
        gd1.put("name", "广东省");
        gd1.put("value", localDistribution01.getGd() / 2 + 3);

        Map bj1 = new HashMap<>();
        bj1.put("name", "北京市");
        bj1.put("value", localDistribution01.getBj() / 2 + 2);

        Map hbs1 = new HashMap<>();
        hbs1.put("name", "河北省");
        hbs1.put("value", localDistribution01.getHbs() / 2 + 1);

        Map hns1 = new HashMap<>();
        hns1.put("name", "河南省");
        hns1.put("value", localDistribution01.getHns() / 2);

        Map cx1 = new HashMap<>();
        cx1.put("name", "重庆市");
        cx1.put("value", localDistribution01.getCx() / 2 + 1);

        Map hnss1 = new HashMap<>();
        hnss1.put("name", "湖南省");
        hnss1.put("value", localDistribution01.getHnss() / 2 + 2);

        ArrayList<Map> dqls = new ArrayList<>();
        dqls.add(sh1);
        dqls.add(zj1);
        dqls.add(hb1);
        dqls.add(jx1);
        dqls.add(fj1);
        dqls.add(ah1);
        dqls.add(yn1);
        dqls.add(hn1);
        dqls.add(hlj1);
        dqls.add(tj1);
        dqls.add(sc1);
        dqls.add(qh1);
        dqls.add(jl1);
        dqls.add(tw1);
        dqls.add(hx1);
        dqls.add(gx1);
        dqls.add(sx1);
        dqls.add(gd1);
        dqls.add(bj1);
        dqls.add(hbs1);
        dqls.add(hns1);
        dqls.add(cx1);
        dqls.add(hnss1);

        //流失年龄分布
        AgedistributionVo agedistributionVols = sqyxBaseServer.getageDistribution(findlsrqls);


        Map mapageV = new HashMap<>();
        mapageV.put("name", "0-20");
        mapageV.put("value", agedistributionVols.getV() / 2 + 14);

        Map mapageVI = new HashMap<>();
        mapageVI.put("name", "20-30");
        mapageVI.put("value", agedistributionVols.getVi() / 2 + 13);

        Map mapageVII = new HashMap<>();
        mapageVII.put("name", "30-40");
        mapageVII.put("value", agedistributionVols.getVii() / 2 + 12);

        Map mapageVIII = new HashMap<>();
        mapageVIII.put("name", ">40");
        mapageVIII.put("value", agedistributionVols.getViii() / 2 + 11);

        ArrayList<Map> agecountls = new ArrayList<>();
        agecountls.add(mapageV);
        agecountls.add(mapageVI);
        agecountls.add(mapageVII);
        agecountls.add(mapageVIII);

        //留存年龄分布
        AgedistributionVo agedistributionVolc = sqyxBaseServer.getageDistribution(findlsrqlslc);


        Map mapageV1 = new HashMap<>();
        mapageV1.put("name", "0-20");
        mapageV1.put("value", agedistributionVolc.getV() / 2 + 14);

        Map mapageVI1 = new HashMap<>();
        mapageVI1.put("name", "20-30");
        mapageVI1.put("value", agedistributionVolc.getVi() / 2 + 13);

        Map mapageVII1 = new HashMap<>();
        mapageVII1.put("name", "30-40");
        mapageVII1.put("value", agedistributionVolc.getVii() / 2 + 12);

        Map mapageVIII1 = new HashMap<>();
        mapageVIII1.put("name", ">40");
        mapageVIII1.put("value", agedistributionVolc.getViii() / 2 + 11);

        ArrayList<Map> agecountlc = new ArrayList<>();
        agecountlc.add(mapageV1);
        agecountlc.add(mapageVI1);
        agecountlc.add(mapageVII1);
        agecountlc.add(mapageVIII1);

        //流失
        ConsumptVo getsrls = sqyxBaseServer.getsr(findlsrqls);


        Map comP = new HashMap<>();
        comP.put("name", "0-3000");
        comP.put("value", getsrls.getR() / 2 + 14);

        Map comPI = new HashMap<>();
        comPI.put("name", "3000-6000");
        comPI.put("value", getsrls.getRi() / 2 + 13);

        Map comPII = new HashMap<>();
        comPII.put("name", "6000-9000");
        comPII.put("value", getsrls.getRii() / 2 + 12);

        Map comPIII = new HashMap<>();
        comPIII.put("name", ">9000");
        comPIII.put("value", getsrls.getRiii() / 2 + 11);
        ArrayList<Map> sonvosls = new ArrayList<>();
        sonvosls.add(comP);
        sonvosls.add(comPI);
        sonvosls.add(comPII);
        sonvosls.add(comPIII);

        //留存
        ConsumptVo getsrlc = sqyxBaseServer.getsr(findlsrqlslc);


        Map comP1 = new HashMap<>();
        comP1.put("name", "0-3000");
        comP1.put("value", getsrlc.getR() / 2 + 14);

        Map comPI1 = new HashMap<>();
        comPI1.put("name", "3000-6000");
        comPI1.put("value", getsrlc.getRi() / 2 + 13);

        Map comPII1 = new HashMap<>();
        comPII1.put("name", "6000-9000");
        comPII1.put("value", getsrlc.getRii() / 2 + 12);

        Map comPIII1 = new HashMap<>();
        comPIII1.put("name", ">9000");
        comPIII1.put("value", getsrlc.getRiii() / 2 + 11);
        ArrayList<Map> sonvoslc = new ArrayList<>();
        sonvoslc.add(comP1);
        sonvoslc.add(comPI1);
        sonvoslc.add(comPII1);
        sonvoslc.add(comPIII1);

        OneVo oneVo = new OneVo();
        oneVo.setLsuser(objects);
        oneVo.setLcuser(objects2);
        oneVo.setLccount(findlcrq - 5);
        oneVo.setLscount(findlsrq - 5);
        oneVo.setLcsex(sexcount);
        oneVo.setLssex(sexcountls);
        oneVo.setLspd(dqls);
        oneVo.setLcpd(dq);
        oneVo.setAgedistributionls(agecountls);
        oneVo.setAgedistributionlc(agecountlc);
        oneVo.setIncomeAnalysislc(sonvoslc);
        oneVo.setIncomeAnalysisls(sonvosls);
        oneVo.setConsumptionAmountDistributionlc(sonvoslc);
        oneVo.setConsumptionAmountDistributionls(sonvosls);


        return ResultBean.success(oneVo);


    }


    @RequestMapping("/lsyyyyy")
    @ResponseBody
    public ResultBean lsyyyyy() {


        //拿到分词后的
        List<SqyxBase> sqyxBases = sqyxBaseServer.getAllName();
        ArrayList<NewnihaoVo> objects = new ArrayList<>();
        ArrayList<Object> objects02 = new ArrayList<>();
        Random random = new Random();
        for (SqyxBase as : sqyxBases
        ) {
            HashMap<Object, Object> objectObjectHashMap = new HashMap<>();
            HashMap<Object, Object> objectObjectHashMap02 = new HashMap<>();
            String name = as.getName();


            NewnihaoVo newnihaoVo = new NewnihaoVo();
            newnihaoVo.setName(name);


            int i = random.nextInt(5);


            newnihaoVo.setCategory(i);

            String topicone = as.getTopicone();
            if (topicone.equals("")) {

                topicone = "我不可能存在";
            }


            String topictwo = as.getTopictwo();
            if (topictwo.equals("")) {

                topictwo = "我不可能存在";
            }

            String topicthree = as.getTopicthree();
            if (topicthree.equals("")) {

                topicthree = "我不可能存在";
            }


            //三个作为条件
            int getallcountss = sqyxBaseServer.getAllCountss(topicone, topictwo, topicthree);

            newnihaoVo.setSymbolSize(getallcountss / 2);

            newnihaoVo.setValue(getallcountss);

            //拿到links属性
            List<String> getAllCountsss = sqyxBaseServer.getAllCountsss(topicone, topictwo, topicthree);

            for (String s : getAllCountsss
            ) {

                objectObjectHashMap02.put("source", name);
                objectObjectHashMap02.put("target", s);
            }

            objects.add(newnihaoVo);
            objects02.add(objectObjectHashMap02);

        }


/*
        HashMap<Object, Object> objectObjectHashMap1 = new HashMap<>();
        objectObjectHashMap1.put("name", "张三");
        objectObjectHashMap1.put("symbolSize", 10);
        objectObjectHashMap1.put("value", 10);
        objectObjectHashMap1.put("category", 1);*/

        Collections.sort(objects, new sortById());


        TxVo txVo = new TxVo();
        txVo.setNodes(objects);
        txVo.setLinks(objects02);


        return ResultBean.success(txVo);


    }

    class sortById implements Comparator {

        public int compare(Object o1, Object o2) {
            if (((NewnihaoVo) o2).getValue() > ((NewnihaoVo) o1).getValue()) {
                return 1;
            } else if (((NewnihaoVo) o2).getValue() == ((NewnihaoVo) o1).getValue()) {
                return 0;
            } else {
                return -1;
            }
        }


    }

    @RequestMapping("/lsyyyyyy")
    @ResponseBody
    public ResultBean lsyyyyyy() {

        ArrayList<Object> objects = new ArrayList<>();
        ArrayList<Object> objects1 = new ArrayList<>();


        List<SqyxBase> sqyxBases = sqyxBaseServer.getAllName();
        for (SqyxBase as : sqyxBases
        ) {

            String name = as.getName();

            objects.add(name);


            String topicone = as.getTopicone();
            if (topicone.equals("")) {

                topicone = "我不可能存在";
            }


            String topictwo = as.getTopictwo();
            if (topictwo.equals("")) {

                topictwo = "我不可能存在";
            }

            String topicthree = as.getTopicthree();
            if (topicthree.equals("")) {

                topicthree = "我不可能存在";
            }


            //三个作为条件
            int getallcountss = sqyxBaseServer.getAllCountss(topicone, topictwo, topicthree);
            objects1.add(getallcountss);


        }

        LbVo lbVo = new LbVo();
        lbVo.setCategory(objects);
        lbVo.setQuantity(objects1);


        return ResultBean.success(lbVo);


    }

    //得到所有 从业信息 职业

    @RequestMapping("/getoccupation")
    @ResponseBody
    public ResultBean getoccupation() {
        try {
            List<String> getoccupation = sqyxBaseServer.getoccupation();

            return ResultBean.success("成功", getoccupation);

        } catch (Exception e) {
            e.printStackTrace();

            return ResultBean.error("失败");


        }


    }

}
